Reputation: 103
I am a beginner and was "playing around" with environments a bit. I came across a situation where it seemed that I had two environments activated: I create a directory, create an environment with venv, activate it and then also conda activate a conda environment which I created before. These are the commands:
mkdir dummie_directory
cd dummie_directory
python -m venv .
Scripts\activate
conda activate old_env
After this the beginning of my command line looks like this:
(old_env)(dummie_directory) C:\Users\....
Does this mean that both environments are active? Is there any intended use for this or will it most likely lead to some kind of clash/conflict between the installed packages?
Thanks
Upvotes: 10
Views: 4077
Reputation: 5723
I would add that the only difference it makes from just activating the last environment is that when the last environment is deactivated the first one is again reactivated. So, it uses a first-in-first-out logic to activate environments.
Upvotes: 1
Reputation: 76980
No, it does not mean they are both activated. Only one can have priority in the PATH, which is what I’d consider the simplest definition of what “activated” means, functionally. The indicators in the PS1 string (i.e., the shell’s prompt string) are not robustly managed. The two environment managers are simply unaware of each other, and the string is only manipulated when an activate
or deactivate
procedure is called. There isn’t any dynamic monitoring that a particular environment is remaining active.
I wouldn’t rely on any behavior you observe in this state. It does not have a defined specification and is not intended to be used like this.
Upvotes: 9