Does anaconda create a separate PYTHONPATH variable for each new environment?

I am starting to work with the Anaconda package from Continuum.io to make scipy work. I managed to start and run anaconda, but I can’t say if anaconda creates a new PYTHONPATH environment variable for each new environment it creates or does it use the common PYTHONPATH system? I could not find any information about this in the documentation. Also, when I did printenv, I did not see the PYTHONPATH variable in the newly created environment, although I found several new environment variables created by anaconda. The best I can find is that anaconda has added some anaconda directories and a new environment directory to the PATH variable head - but this does not necessarily isolate the new package from the system environment, but close. Does anyone know the answer to this question or have found a way to deal with this problem.

+24
python scipy environment-variables anaconda
Jun 30 '13 at 3:33
source share
2 answers

No, the only thing you need to change for the Anaconda environment is PATH (so that it gets the correct Python from the bin/ environment or Scripts\ on Windows).

How the Anaconda environment works, they tightly bind everything that is installed in the environment. For all purposes, this means that each environment is a completely separate installation of Python and all packages. Using hard links, this is done efficiently. Thus, there is no need to contact PYTHONPATH because the Python binary in the environment is already searching for site packages in the environment and the lib of the environment, etc.

+22
Jul 01 '13 at 14:49
source share

Anaconda does not use PYTHONPATH . However, it should be noted that if the PYTHONPATH parameter is set, it can be used to load a library that is not in the anaconda environment. This is why, before activating the environment, it may be useful to do

 unset PYTHONPATH 

For example, this PYTHONPATH points to an invalid pandas lib:

 export PYTHONPATH=/home/john/share/usr/anaconda/lib/python source activate anaconda-2.7 python >>>> import pandas as pd /home/john/share/usr/lib/python/pandas-0.12.0-py2.7-linux-x86_64.egg/pandas/hashtable.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/john/share/usr/lib/python/pandas-0.12.0-py2.7-linux-x86_64.egg/pandas/__init__.py", line 6, in <module> from . import hashtable, tslib, lib ImportError: /home/john/share/usr/lib/python/pandas-0.12.0-py2.7-linux-x86_64.egg/pandas/hashtable.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8 

Disabling PYTHONPATH prevents the loading of the wrong pandas lib:

 unset PYTHONPATH source activate anaconda-2.7 python >>>> import pandas as pd >>>> 
+13
Aug 05 '15 at 19:24
source share



All Articles