LinuxCommandLibrary

conda-deactivate

Deactivate current Conda environment

TLDR

Deactivate a conda environment

$ conda deactivate
copy

SYNOPSIS

conda deactivate

DESCRIPTION

The conda deactivate command exits the currently active Conda environment, restoring the shell's PATH and environment variables to their previous state. Conda environments isolate package dependencies, and activation prepends the environment's bin directory to PATH. Deactivation reverses this, switching back to the base environment or prior stacked environment.

This command is crucial for developers managing multiple projects with conflicting dependencies. Unlike older source deactivate, modern conda deactivate works cross-shell without sourcing scripts. It handles environment stacking: if environments are nested (e.g., base → env1 → env2), repeated calls peel them off one by one until base.

No arguments are needed; it targets the innermost active environment. If no environment is active, it typically does nothing silently. Requires conda shell initialization via conda init. Available in Anaconda/Miniconda distributions for Linux, macOS, Windows.

CAVEATS

No effect if no environment active; repeat for stacked envs. Requires conda init in shell. Not for permanent PATH changes.

SHELL INTEGRATION

Run conda init <shell> (e.g., bash) to enable; restarts shell after.

VERIFICATION

Check with conda info --envs (* marks active) or echo $CONDA_DEFAULT_ENV.

HISTORY

Replaced source deactivate in conda 4.6 (2018) for cross-platform, subcommand consistency. Evolved with environment stacking in 4.7+.

SEE ALSO

conda(1), mamba(1)

Copied to clipboard