I am trying to re-enter my conda environment but I am having trouble doing so as when I type conda activate (evironment name)
or source activate (environment name)
both return the error 'Could not find conda environment.' This is very strange as when I type conda info --envs
, I get this:
# conda environments:
#
base * /Users/(my name)/anaconda3
/anaconda3/envs/(environment name)
Best Answer
Names and Prefixes
For a Conda environment to have a name it must be installed in one of the
envs_dirs
directories (seeconda 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.,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 beNote 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 withThat is, this will let one pick up the "names" of the environments installed in
/anaconda3/envs
, but callingconda create -n foo
would still create it in/Users/(my name)/anaconda3/envs/foo
.For documentation, see:
conda config --describe envs_dirs