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

krishnab picture krishnab · Jun 30, 2013 · Viewed 111.4k times · Source

I am starting to work with the Python Anaconda distribution from Continuum.io to do scipy work.
I have been able to get Anaconda up and running, but I cannot tell whether Anaconda creates a new PYTHONPATH environment variable for each new environment it creates, or whether it relies on the common system PYTHONPATH.

I could not find any information on this in the documentation.

Further, when I did a printenv, I did not see a PYTHONPATH variable in the newly created environment --though I did find a few new anaconda created environment variables.

The best I can find is that Anaconda added some Anaconda directories and the new environment directory to the head of PATH variable --but this does not necessarily isolate the new package from the system environment but it is close.

Does anyone know the answer to this question or found a way to deal with this concern?

Answer

asmeurer picture asmeurer · Jul 1, 2013

No, the only thing that needs to be modified for an Anaconda environment is the PATH (so that it gets the right Python from the environment bin/ directory, or Scripts\ on Windows).

The way Anaconda environments work is that they hard link everything that is installed into the environment. For all intents and purposes, this means that each environment is a completely separate installation of Python and all the packages. By using hard links, this is done efficiently. Thus, there's no need to mess with PYTHONPATH because the Python binary in the environment already searches the site-packages in the environment, and the lib of the environment, and so on.