anaconda / anaconda-project

Tool for encapsulating, running, and reproducing data science projects
https://anaconda-project.readthedocs.io/en/latest/
Other
222 stars 88 forks source link

[BUG] When I copy a conda env with copy -r old_env_dir new_env_dir, they are not independent #409

Open chansonzhang opened 1 month ago

chansonzhang commented 1 month ago

cp -r old_env new_env conda activate old_env pip install transformers==4.38.1 conda activate new_env pip install transformers==4.45.2 conda activate old_env pip list|grep transformer here I expect transformers in old_env is still 4.38.1, but it appears to influenced by the installation in new_env and got version 4.45.2

chansonzhang commented 1 month ago

conda version is 24.5.0

jbednar commented 2 weeks ago

I'm not an expert on the conda internals, but as I understand it, conda has to hard-code the path to the environment within various files that are in that environment. So environments are not relocatable once installed. So whenever you use an environment, you need to make sure it's in the same location on the filesystem as when it was created. I.e., if you do want to make copies and move things around, fine, but then just make sure that the environment is back in its original location before you install or use anything on it!