conda-activate
Activate a Conda environment
TLDR
Activate an existing environment named myenv
Activate an existing environment located at custom path
Stack myenv environment on top of a previous environment making libraries/commands/variables from both accessible
Start a clean environment myenv without stacking it making previous environment libraries/commands/variables not accessible
Display help
SYNOPSIS
conda activate [-h] [--dry-run] [--no-hoist] [--stack] [--no-stack] [--reverse] [prefix]
PARAMETERS
-h, --help
Show help message and exit
--dry-run
Display commands without executing changes to PATH or PS1
--no-hoist
Disable package hoisting for faster activation (ignores build shortcuts)
--stack
Push current environment onto stack before activating new one
--no-stack
Prevent stacking; deactivate current before activating new
--reverse
Reverse last stacking operation (deactivate top environment)
prefix
Environment name or full path to prefix (defaults to base if omitted)
DESCRIPTION
The conda activate command (often invoked via shell hooks as part of Conda's initialization) activates a specified Conda environment, modifying the current shell session to use packages and binaries from that environment. It prepends the environment's bin directory to the PATH, updates shell prompt (PS1) to indicate the active environment, and sets environment variables like CONDA_DEFAULT_ENV, CONDA_PREFIX, and CONDA_PROMPT_MODIFIER.
This enables isolated Python interpreters, libraries, and tools without system-wide installation. Unlike older source activate, conda activate works reliably across shells (bash, zsh, fish, etc.) via init scripts in $CONDA_PREFIX/etc/profile.d/conda.sh. Activation is non-destructive; conda deactivate restores the previous state. Stacking allows multiple environments, useful for dependency hell scenarios.
Requires Conda shell integration: run conda init once. Note: 'conda-activate' may refer to internal hook scripts like those in etc/profile.d, but user-facing is conda activate. Supports base environment activation too.
CAVEATS
Requires shell initialization via conda init <shell>; fails silently in non-interactive shells. Environment names are case-sensitive. Stacking limited by shell recursion depth. Not for Windows cmd.exe (use conda-activate.bat).
SHELL HOOKS
Activation sources $CONDA_PREFIX/etc/profile.d/conda.sh, defining __conda_activate function. Manual sourcing enables in custom shells.
STACK MANAGEMENT
Use conda activate --stack for layered envs; view stack with conda info --envs (active marked with *).
HISTORY
Introduced in Conda 4.6 (2018) as robust replacement for source activate/deactivate scripts, which were unreliable across shells. Developed by Anaconda Inc. to support multi-shell integration via hooks. Enhanced in 4.8+ with stacking and hoisting optimizations. Now standard in Miniconda/Anaconda distributions.
SEE ALSO
conda(1), conda-deactivate(1), source(1), bash(1)


