I am using macOS 12.13.5. I have problems using PyPlot in Jupyter using Julia and with Juno in Julia Pro. I created two environment variables in my .bash_profile (PYTHON and JUPYTER) pointing to my Anaconda path (/Users/my_name/anaconda3/bin/python) for python 3. I did the same for Jupyter.
After that, I launched JuliaPro-0.6.2.2 from Terminal and tried to rebuild PyCall package using Pkg.build("PyCall") but I got the following problem (PyCall is not using my Python PATH):
INFO: Building Conda
INFO: Building PyCall
INFO: PyCall is using /usr/bin/python (Python 2.7.10) at /usr/bin/python, libpython = /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7
Thanks. I did it an hour ago and it works both in Jupyter and in Juno.
I don’t understand why simply defining the PYTHON variable in .bash_profile was not enough.
Neither do I, it’s supposed to load that in the environment. Stupid question, but did you explicitly check echo $PYTHON right before you launched Julia to check that it was set correctly?
Note that you only need to set these environment vars the first time you run Pkg.build, and the PyCall and IJulia packages will subsequently remember the setting, so there is no need to set them permanently in your .bash_profile.
Did you export the variable? i.e. the difference between:
PYTHON=/path/to/python
and
export PYTHON=/path/to/python
Non-exported variables aren’t inherited by child processes, so while you can echo in a shell (which will source your .bash_profile), things you start after that won’t see the variable. An example of this is: