Importing Python Module in Julia: MESA_reader


#1

Hello,

I would like to preface my question with a note that MESA is a stellar evolution code (http://mesa.sourceforge.net/)

I’m trying to import mesa_reader - a Python module for reading MESA output - with PyCall, but am receiving the following error:
Is this because mesa_reader is a 3rd party Python module?
Details about mesa_reader are here: https://github.com/wmwolf/py_mesa_reader
I installed mesa_reader in my Python site packages as noted.

Thanks!


#2

No, PyCall doesn’t care whether the module is built-in or 3rd-party.

Probably you installed it into the wrong version of Python. Looking at PyCall.python will tell you what version of Python PyCall is configured to use on your system. By default on Mac and Windows, it uses its own Anaconda “miniconda” distribution via the Conda package for Julia, and you can install Anaconda Python packages via using Conda; Conda.add("somepackage"). However, it doesn’t look like there is an Anaconda package for mesa_reader?

To switch PyCall to use a different version/installation of Python on your system, set the PYTHON environment variable to the path of the python executable you want to use and re-run Pkg.build("PyCall"), as explained in the PyCall README. (You will need to quit Julia and re-launch it.)