Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does conda-env list / conda info --envs find environments?

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.

like image 848
pgoetz Avatar asked Jan 11 '19 18:01

pgoetz


1 Answers

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.

like image 94
darthbith Avatar answered Sep 20 '22 01:09

darthbith