Could not find conda environment

Names and Prefixes

For a Conda environment to have a name it must be installed in one of the envs_dirs directories (see conda config --show envs_dirs). Creating an environment outside of one of those forfeits its “name-ability”. Instead, one must use the path (called its prefix) to activate it, e.g.,

conda activate /anaconda3/envs/my_env

Other commands will require one to use the --prefix|-p flag to specify the environment. See the documentation on “Specifying the location for an environment“.

Adding Other Env Locations

If one plans to frequently install in a different location than the default, then there is an option to add directories to the envs_dirs configuration variable. In this specific case, this would be

conda config --append envs_dirs /anaconda3/envs

Note that whatever directory one specifies in this command will become the de facto default for future installs using the --name|-n flag. If one still wants to keep the standard default (/Users/<user>/anaconda3/envs), then they should follow the above with

conda config --prepend envs_dirs /Users/<user>/anaconda3/envs

That is, this will let one pick up the “names” of the environments installed in /anaconda3/envs, but calling conda create -n foo would still create it in /Users/(my name)/anaconda3/envs/foo.

For documentation, see: conda config --describe envs_dirs

Leave a Comment