Sharon
Sharon

Reputation: 171

Isolated virtual environment using conda

I am using ubuntu 14 system. I have installed Miniconda in my system. I created a virtual environment using conda. I thought virtual environment created using conda does not have access to root environment. But to my surprise I could access packages installed in root environment.

I have installed wireshark in my root environment but not in the virtual environment. But when I tried the command

which wireshark  

from my virtual environment, it showed the path in root. How is that possible that I could get information about an external package when I am in a virtual environment which is supposed to be isolated from other environments. My questions are :

how virtual environment created using conda works?

How to create isolated virtual environment using conda

Upvotes: 2

Views: 1685

Answers (1)

darthbith
darthbith

Reputation: 19617

What conda does when you activate a new environment is put the bin directory for that environment at the front of the PATH (and modify some other stuff too, but that's most relevant for this example). However, you still need to be able to access the conda executable, so the bin directory of the root environment must remain on the PATH. Therefore, Bash can find executables from the root environment. However, the Python interpreter should not find packages that are in root but not the conda environment.

If you don't want this to happen, don't install packages in the root environment, only use conda environments (note that these are different from virtual environments created by, e.g., virtualenv)

Upvotes: 1

Related Questions