0

I can't run an executable from python 3 within Spyder or Jupyter Anaconda Channels. This is because my system path is not recognised. If in my OSX Terminal I write:

activate myEnv
python3 -c 'import os; print(os.environ["PATH"])'

I get the content of my usual system PATH, but when I do it in python 3 through Anaconda channels Spyder or Jupyter-Notebook, under the same environment, i.e. myEnv, the PATH is different.

import os
print(os.environ["PATH"])

enter image description here

I understood this happens because python environments inherit from different processes, but how can I then set, under Anaconda channels Spyder or Jupyter, my usual environment, and PATH?

PS I found other questions similar to my one, but not sure to understand how to practically use the provided answers.

hank7v
  • 31
  • 7
  • Do you want to completely replace PATH as defined in Spyder/Jupyter? Or just append additional paths to it? – Carlos Cordoba Oct 15 '20 at 15:20
  • Thanks @CarlosCordoba, just add my paths, cannot find where... – hank7v Oct 15 '20 at 17:09
  • You need to add those paths to your `~/-profile` or `~/.bashrc` files and start Spyder or Jupyter in your terminal. – Carlos Cordoba Oct 15 '20 at 19:24
  • Hi @CarlosCordoba, I did it of course (actually they were already there, in fact, everything works fine out of Anaconda). Anaconda modified my .bash_profile file, thus I added them to it as well, but it doesn't affect the behaviour. This is exactly my point, I don't really know where else I should add those paths. – hank7v Oct 16 '20 at 08:21
  • I added a picture of my Jupyter Lab, to better show the (to me unexpected) behaviour. Same happens in Spyder. – hank7v Oct 16 '20 at 08:28
  • Ok, thanks for the picture, I understand what you meant now. I Spyder this should be solved since version 4.1.0, released 8 months ago. Jupyter doesn't have something similar by default (as far as I know). – Carlos Cordoba Oct 16 '20 at 23:18
  • 1
    Hi, thanks again. In the end, I added my paths to the conda.sh file directly, instead of to the .bash_profile modified by Conda during installation, and it works for both Spyder and Jupyter. – hank7v Oct 17 '20 at 09:09

0 Answers0