How does conda-env list / conda info --envs find environments?
The code for the info
command is contained in the cli.main_info
module, and the relevant code for this case is here. This imports the function from over here that (among other things) reads the configuration value envs_dirs
. You can find out the value of this configuration value on your system by running
conda config --show envs_dirs
I expect this will show you the user directories for environments as being searched.
pgoetz
Updated on June 24, 2022Comments
-
pgoetz almost 2 years
I've been experimenting with anaconda/miniconda because my users use structural biology programs installed with miniconda and none of the authors A) take into account that there might be other miniconda applications B) that their programs will be used in a multi-user environment.
So, using Arch linux, first I installed anaconda (version 4.5.12) , and then using my own account, created a couple of test environments:
conda create -n snakes conda create -n sharks
I then (completely) uninstalled anaconda and installed miniconda (also version 4.5.12) and then created another environment in a non-standard location as root:
# conda create -p /usr/local/miniconda/pyem
Here's where things get weird. When I list the environments as the root user, I see not only the default and the one I just created, but also the ones I created previously using my user account!
[root@lizard /]# conda info --envs # conda environments: # /home/cnsit/.conda/envs/sharks /home/cnsit/.conda/envs/snakes base * /opt/miniconda3 /usr/local/miniconda/pyem
(The
conda-env list
command gives the same output.)So, question: how is conda finding environments created by a different user? Moreover, when the entire parent directory of the original instance of conda has been removed and replaced by one in an entirely different location (so no local environments.txt file could be cataloging this.
-
pgoetz over 5 yearsThanks. The only remaining question is how to properly change envs_dirs.
-
darthbith over 5 years
conda config --add/--remove/--append envs_dirs dir_name
. But some of it may be built in. Is there a problem with showing all the environments? -
pgoetz over 5 yearsNo, they show up when I run the command you posted. It just appears that by default conda is designed for single user use, and I have to set up some applications in a multi-user environment accessible from an NFS=-mounted filesystem, so I was looking into moving things around a bit and putting these conda environments in, for example, /usr/local/miniconda.
-
darthbith over 5 yearsYou could definitely do that, you can put a config file (I forget the name right now) either in each user's home directory or in a system location to add envs_dirs to be searched
-
pgoetz over 5 yearsIt's called .condarc: conda.io/docs/user-guide/configuration/use-condarc.html