What is the 'root' environment in conda? Is it just an environment which uses (only) the system packages?
Do other environments use the system packages as well (I would assume giving preference to their versions of duplicates)?
Or would I need to install all of my packages in the environment where I want to use them?
Is there a way of configuring this as an option?
I have a system package installed but I can't import it when I'm in a conda environment.
The root environment is just the environment you start in. You only have access to python packages that you've explicitly installed in the current conda environment. Here is what my system looks like. Note that all the paths in the python module search list (sys.path) are in the root conda folder:
jmepple-lm:~ jmeppley$ conda env list
# conda environments:
#
anvio /Users/jmeppley/anaconda3/envs/anvio
anvio2 /Users/jmeppley/anaconda3/envs/anvio2
jupyter /Users/jmeppley/anaconda3/envs/jupyter
snake /Users/jmeppley/anaconda3/envs/snake
root * /Users/jmeppley/anaconda3
jmepple-lm:~ jmeppley$ python -c "import sys; print(\"\\n\".join(sys.path))"
/Users/jmeppley/anaconda3/lib/python35.zip
/Users/jmeppley/anaconda3/lib/python3.5
/Users/jmeppley/anaconda3/lib/python3.5/plat-darwin
/Users/jmeppley/anaconda3/lib/python3.5/lib-dynload
/Users/jmeppley/anaconda3/lib/python3.5/site-packages
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/aeosa
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/galaxy_lib-17.5.9-py3.5.egg
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/mmtf_python-1.0.5-py3.5.egg
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/pysftp-0.2.8-py3.5.egg
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/python_dateutil-2.3-py3.5.egg
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg
/Users/jmeppley/anaconda3/lib/python3.5/site-packages/urllib3-1.12-py3.5.egg
When you switch conda environments, python will now pull python modules from folders specific to that environment:
jmepple-lm:~ jmeppley$ source activate snake
(snake) jmepple-lm:~ jmeppley$ python -c "import sys; print(\"\\n\".join(sys.path))"
/Users/jmeppley/anaconda3/envs/snake/lib/python35.zip
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/plat-darwin
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/lib-dynload
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/site-packages
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/site-packages/mmtf_python-1.0.5-py3.5.egg
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/site-packages/pysftp-0.2.8-py3.5.egg
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/site-packages/python_dateutil-2.3-py3.5.egg
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg
/Users/jmeppley/anaconda3/envs/snake/lib/python3.5/site-packages/urllib3-1.12-py3.5.egg
If you want access to a python module, you'll have to instal it explicitly in that conda environment with conda install XXX
(recommended) or pip install XXX
.
As far as I know, there is no easy way to override this behavior.
NOTE: This is not true for non-python programs. Any programs in your execution path will always be available, with preference given to programs installed via conda. This is because the conda install location is at the start of your PATH. EG:
(snake) jmepple-lm:~ jmeppley$ echo $PATH
/Users/jmeppley/anaconda3/envs/snake/bin:/Users/jmeppley/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With