Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conda remove all environments (except root)

I know I can delete a single environment with

 conda remove -n envname --all 

but I often create multiple new environments for installing a specifiy package or testing it so I'll regularly end up with 5-10 environments and it's a pain to delete them after one another. Is there an easy way (for windows) to delete all environments except the root-environment?

like image 522
MSeifert Avatar asked Mar 01 '16 11:03

MSeifert


People also ask

How do you change the root environment in Anaconda?

Go to the start menu, right-click 'Anaconda Prompt' and go to file location. Open its properties & change the target to the location of your preferred environment.

What does conda remove do?

Remove a list of packages from a specified conda environment. This command will also remove any package that depends on any of the specified packages as well---unless a replacement can be found without that dependency.


2 Answers

Removing all directories inside the envs subdirectory that resides inside conda does the job. This is generally in your user folder ~.

~\.conda\envs\ 
like image 131
Edison Gustavo Muenz Avatar answered Oct 05 '22 01:10

Edison Gustavo Muenz


Mac/Linux based systems could remove all environments like this.

for i in `conda env list|awk '{print $1}'|egrep -v 'base|#'|tr '\n' ' '`;do echo $i;conda env remove --name $i;done 
like image 23
Akhil Jain Avatar answered Oct 05 '22 01:10

Akhil Jain