I am trying to show names (aliases) for conda environments from both Miniconda as well as Aanaconda. Currently, my default conda executable comes from Miniconda.
For some background, I have Miniconda installed in $HOME/packages/miniconda3
and Anaconda installed in /opt/anaconda3/
(perhaps there is a better way of doing this, but this is just how the installation ended up happening for projects I'm working on).
$ conda env list
# conda environments:
#
base * $HOME/packages/miniconda3
ai $HOME/packages/miniconda3/envs/ai
test-project $HOME/packages/miniconda3/envs/test-project
/opt/anaconda3
/opt/anaconda3/envs/interviews
/opt/anaconda3/envs/teaching
I have slightly edited the output here like abbreviating my home directory as $HOME and renaming some of the conda environments.
Currently my base
environment for Miniconda is in $HOME/packages/miniconda3
and my base
environment for Anaconda is in /opt/anaconda3
. I would like my three Anaconda environments to also show their alias names (like the Miniconda environments do) so that I can activate between a Miniconda and Anaconda environment without having to copy the full path, such as conda activate /opt/anaconda3/envs/interviews
.
Is there a way to enable this name aliasing for both Miniconda and Anaconda simultaneously?
One should not be installing Miniconda and Anaconda side-by-side. If you need an Anaconda environment, just use Miniconda and create an env with the anaconda
metapackage.
Despite my concern there, the nameability of environments is controlled by whether the subsuming folder is listed in the envs_dirs
configuration setting. Hence, you should be able to get the behavior you want with something like
conda config --append envs_dirs /opt/anaconda3/envs