Reputation: 1230
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?
Upvotes: 4
Views: 1197
Reputation: 7929
conda env
has been deprecated, see conda -h
output. The documentation now only mentions conda remove --all -n myenv
to remove an environment.
$ conda -V
22.11.1
$ conda -h
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
clean Remove unused packages and caches.
compare Compare packages between conda environments.
config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (/Users/corneliusromer/.condarc) by default. Use the --show-
sources flag to display all identified configuration locations on your computer.
create Create a new conda environment from a list of specified packages.
info Display information about current conda install.
init Initialize conda for shell interaction.
install Installs a list of packages into a specified conda environment.
list List installed packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove (uninstall)
Remove a list of packages from a specified conda environment.
rename Renames an existing environment.
run Run an executable in a conda environment.
search Search for packages and display associated information.The input is a MatchSpec, a query language for conda packages. See examples below.
update (upgrade) Updates conda packages to the latest compatible version.
notices Retrieves latest channel notifications.
options:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages (legacy):
env
Note the "(legacy)" in "conda commands available from other packages (legacy)". For now (July 2023), legacy means this may be removed in the future, however it's still available.
Upvotes: 2
Reputation: 76750
There is no difference in effect.
Conda has two remove
commands:
conda remove
- for removing packagesconda env remove
- for removing environmentsBoth 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.
Upvotes: 2