Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the --all flag do for conda env remove?

I would like to delete an Anaconda environment. From this reference, it looks like I could use

conda remove --name myenv --all

or

conda env remove --name myenv

The documentation (for 4.6.0) mentions both, but does not explain the difference.

How might I determine what the --all flag does?

like image 516
mherzog Avatar asked Oct 28 '25 03:10

mherzog


1 Answers

There is no difference in effect.

Conda has two remove commands:

  • conda remove - for removing packages
  • conda env remove - for removing environments

Both have a --name,-n argument that specifies the environment on which to operate. Only the former also has an --all flag, which effectively does the same thing as the latter.1


Obsolete (From Original Answer)

The original first example in the question had a typo and was invalid because it indicated to remove package(s) from an environment, but did not specify any packages. Running it would have yielded an error message:

$ conda remove -n myenv

CondaValueError: no package names supplied,
       try "conda remove -h" for more details

[1] This is a slightly inconsistent API design, in my opinion. Since one can create an empty environment, I believe a more symmetric result of conda remove --all would be that it remove all the packages but still retain the empty environment. Users that want to operate on a whole environment level should being using conda env commands. Unfortunately, this overlap of functionality is an artifact of ontogeny, namely, conda-env was originally a separate package that came after conda, and so conda remove -n envname --all was the original idiom for environment removal.

like image 195
merv Avatar answered Oct 29 '25 18:10

merv