Problems configuring PyCall

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- from Terminal and tried to rebuild PyCall package using"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

Try explicitly setting ENV["PYTHON"] to the path you’d like it to use.

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?

Yes, I did it, both for PYTHON and JUPYTER.

I suspect that somehow Jupyter is running in a different environment, but I don’t use it, so I don’t know for sure.

I had problems before with PyPlot and Jupyter. Now they are solved.
I followed the instructions in the Julia Pro manual.

Note that you only need to set these environment vars the first time you run, and the PyCall and IJulia packages will subsequently remember the setting, so there is no need to set them permanently in your .bash_profile.

1 Like

OK. Thank you for your advice.

No dia 19/06/2018, Ă s 21:18, Steven G. Johnson escreveu:

Did you export the variable? i.e. the difference between:



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:

$ TESTVAR=nonempty
$ echo $TESTVAR
$ bash -c 'echo $TESTVAR'

$ export TESTVAR
$ bash -c 'echo $TESTVAR'
1 Like

No, I didn’t export them. I understand now the reason why it didn’t work.

No dia 20/06/2018, Ă s 02:28, jmert escreveu: