Command referenceconda deactivate (nested)
conda deactivate (nested) command (Linux & Windows / Conda)
What it does
Leave nested Conda activations until no Conda env remains active in the shell. When people look up conda deactivate nested, they usually want safe flags, copyable examples, and how this Conda subcommand fits Anaconda or Miniconda workflows on Linux, Windows, and macOS. Syntax, options, and practical examples are below.
Leave nested Conda activations until no Conda env remains active in the shell.
Syntax
conda deactivate # repeat until inactive
Common options
| Flag / option | Meaning |
|---|---|
| (repeat) | Each call pops one activation from the stack. |
Practical examples
Pop one level
conda deactivate
Returns to the previously active env or an uninitialized PATH.
Clear nested envs
while [[ "$CONDA_SHLVL" -gt 0 ]]; do conda deactivate; done
Bash helper to leave every nested activation (Unix shells).
Check status
conda info --envs
Confirm no environment is marked active.
Common mistakes
- Assuming one deactivate always returns to the system Python when base auto-activate is enabled.
- Calling deactivate in a shell that never ran `conda init`.
Related commands
- conda deactivateLeave the current Conda environment and restore the previous shell PATH stack.
- conda activateActivate a named or path-based Conda environment in the current shell session.
- conda initConfigure shell startup files so `conda activate` works in bash, zsh, PowerShell, cmd.exe, and others.
- conda env listList all Conda environments and mark the currently active one.
- conda createCreate a new isolated Conda environment with an optional Python version and starter packages.
- conda installInstall packages into the active or named Conda environment from configured channels.
- conda listList packages installed in the active or named Conda environment.
- aptSearch, install, update, and remove packages on Debian-based systems.
FAQ
What does conda deactivate (nested) do in Conda?
Leave nested Conda activations until no Conda env remains active in the shell.
Does conda deactivate (nested) work on Windows and Linux?
Yes. Conda runs on Linux, Windows, and macOS; shell activation differs slightly after `conda init`, but the CLI flags are the same.
What is a practical conda deactivate (nested) example?
Try `conda deactivate` — Returns to the previously active env or an uninitialized PATH.
Is mamba the same as conda deactivate (nested)?
Mamba is a faster drop-in solver for many Conda workflows. Prefer `mamba` only when it is installed; otherwise use the Conda commands on this page.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.