Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to list environments of anaconda *with* dates of creation

Tags:

anaconda

If you do conda info --envs you get a list of the environments you create in anaconda

Is there a way to do this but to get also the dates of creation of these environments?

like image 896
KansaiRobot Avatar asked May 06 '18 10:05

KansaiRobot


2 Answers

You can try the following steps:

  1. Figure out the root folder of all the environments. You can do this by using conda env list command. This will show a list of environments with their path.

  2. You can check the creation date of the folder corresponding to each environment.

For mac, the root folder for all environments was /anaconda3/envs. Inside that folder, just type ls -ltr.

like image 187
vishalaksh Avatar answered Sep 25 '22 02:09

vishalaksh


envs=`conda env list | tail -n +4 $1`; 
IFS=' '; 
for x in ${envs};
 do read -a res <<< "$x";
 echo $(ls --full-time --no-group -g -d $res);
done

Explanation by lines:

  1. List the environments and skip some of it, in this case you should see if +4 is your number (it should be)
  2. The output of conda env list has a white space as delimiter (this ensures that yours IFS has this separator
  3. Iterate over the output
  4. Read every line and split with the delimiter on IFS
  5. Print the environment's folder info hiding some things, like group, author. And the -d arguments that list directories themselves, not their contents.

Feel free to customize yours or edit this one.

like image 37
titusfx Avatar answered Sep 23 '22 02:09

titusfx