You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Want to show users how to create environment by prefix (i.e., in a particular location) but with a name so that it can be activated by name. This appears to be possible.
While possible it is (I think) not best practice, because you can have ambiguous environment names this way.
That is, one could end up accidentally creating two environments with the same name.
Conda would not warn about this, neither at the time of creation or activation.
Here an example:
$ mkdir project1 project2 # create two empty directories
$ conda create --prefix project1/env # create named ("env") environment
$ conda config --append envs_dirs $(pwd)/project1 # make it discoverable by conda
$ conda create --prefix project2/env # create another environment with the same name in a different path
$ conda config --append envs_dirs $(pwd)/project2
$ conda env list # list conda environments
# conda environments:
#
env /home/user/project1/env
env /home/user/project2/env
$ conda activate env
(/home/user/project1/env) $ # the first environment was activated with no warning!
If you try this out on your own device don't forget to clean up your ~/.condarc file when cleaning up afterwards.
All that said, this behavior has been discussed in conda's repository and was not actively discouraged (conda/conda#7831). Still, I believe it might be confusing to learners.
Want to show users how to create environment by prefix (i.e., in a particular location) but with a name so that it can be activated by name. This appears to be possible.
https://stackoverflow.com/questions/49638329/how-to-create-conda-env-with-both-name-and-path-specified
The text was updated successfully, but these errors were encountered: