LinuxCommandLibrary

conda-remove

Remove packages from Conda environment

TLDR

Remove scipy from the currently active environment

$ conda remove scipy
copy

Remove a list of packages from the specified environment
$ conda remove [[-n|--name]] [environment_name] [package1 package2 ...]
copy

Remove all packages and the environment itself
$ conda remove [[-n|--name]] [environment_name] --all
copy

Remove all packages, but keep the environment
$ conda remove [[-n|--name]] [environment_name] --all --keep-env
copy

SYNOPSIS

conda remove [-h] [--all] [--deps|--no-deps] [--force] [--dry-run] [-n ENV | -p PATH] [--yes] [package_spec ...]

PARAMETERS

package_spec [...]
    One or more package specifications (e.g., numpy, python=3.8) to remove from the environment.

-n ENV, --name ENV
    Remove packages from a specified environment by its name. If not specified, the active environment is used.

-p PATH, --prefix PATH
    Remove packages from a specified environment by its full path. Useful when the environment is not in the default Conda environment locations.

--all
    Remove all packages from the specified environment, effectively emptying it. This is a powerful option and should be used with care.

--deps
    Remove packages that are no longer needed as dependencies by other installed packages. This is often the default behavior.

--no-deps
    Do not remove packages that are no longer needed as dependencies. Only remove the explicitly specified packages.

--force, --force-remove
    Force removal of packages even if they are vital for Conda or other packages. Use with extreme caution as this can break your environment.

--dry-run
    Perform a dry run; show what would be removed without actually modifying the environment. Useful for testing commands.

-y, --yes
    Do not ask for confirmation before performing the removal operation. Proceeds automatically.

-q, --quiet
    Do not display progress indicators or other verbose output during the operation.

-v, --verbose
    Use verbose output, showing more details about the operation.

--json
    Report all output as JSON, suitable for programmatic parsing.

DESCRIPTION

conda remove is a fundamental command in the Conda package manager, used to uninstall specified packages from a Conda environment. This command intelligently handles dependencies, by default removing any dependencies that are no longer required by other installed packages, helping to keep environments clean and optimized.

Users can target specific environments using the --name or --prefix options, ensuring precise package management. It's an essential tool for maintaining healthy environments, freeing up space, or resolving conflicts by removing problematic software. While powerful, it should be used with caution, especially when removing packages from the base environment or using options like --all which can completely empty an environment. The command conda uninstall is an alias for conda remove, providing the same functionality.

CAVEATS

When using conda remove, exercise caution:

- Removing packages from the base environment is generally discouraged and can lead to issues with your Conda installation itself.
- The --all option will completely empty the specified environment, which might not be the intended action.
- Using --force can break your environment by removing critical dependencies or Conda's own components.
- Always consider using --dry-run first to understand the potential impact of your command before executing it.

ALIASES

conda uninstall is an alias for conda remove. Both commands perform the exact same function.

REMOVING ENTIRE ENVIRONMENTS

To remove an entire Conda environment, including all its packages, use the conda env remove command instead of conda remove --all. For example: conda env remove -n myenv.

HISTORY

Conda, developed by Continuum Analytics (now Anaconda, Inc.), was open-sourced in 2012 as a cross-platform, language-agnostic package and environment manager. The conda remove command has been a core component since its early inception, providing essential functionality for managing and cleaning environments. Its design reflects Conda's philosophy of robust dependency management, ensuring that environment modifications are handled consistently and safely, evolving alongside other Conda commands to support new features and package types.

SEE ALSO

conda install(1), conda update(1), conda create(1), conda env remove(1), conda list(1)

Copied to clipboard