All cheatsheetsPython Development

conda

Conda 24+

Quick reference for Conda CLI commands: environment management, package install / search, channels, lockfiles, configuration, and cleanup — with common options and practical examples.

40 commands

Help

conda --version

Print the conda version, release date, and Python interpreter in use.

conda --version
conda info

Show platform, Python version, environment directories, channel URLs, and configured package cache.

--envs; --json; --all

conda info --envs
conda help

List every conda subcommand.

conda help
conda help <subcommand>

Show the full flag list and description for one subcommand.

conda help install

Update

conda update conda

Update conda itself to the latest version on the current channel.

-n <env>; --all

conda update conda
conda update --all

Update every package in the current environment to the newest available version.

-n <env>; --no-pin; --strict-channel-priority

conda update --all

Environment

conda create -n <name>

Create a new empty environment named `<name>` (default Python version from the base interpreter).

python=<ver>; -y yes to prompts; --clone <env>; --file <env.yml>; -p <path>

conda create -n py-data python=3.12 -y
conda create -n <name> python=<ver>

Create an environment pinned to a specific Python version.

conda create -n py311 python=3.11 -y
conda env create -f <env.yml>

Create an environment from a YAML spec file — the most reproducible way to share environments.

-n <name>; -p <path>; --prune; --json

conda env create -f environment.yml
conda env update -f <env.yml> --prune

Update an existing environment from a YAML spec file; `--prune` removes packages no longer listed.

conda env update -f environment.yml --prune
conda env export > environment.yml

Export the current environment to a YAML file (no build strings by default — use `--no-builds` for cross-platform portability).

--no-builds; --from-history; --json; --channel-priority strict

conda env export --from-history > environment.yml
conda activate <name>

Activate an environment by name (or path with `conda activate <path>`). On Windows use `activate <name>` from cmd.exe.

<name>; <path>

conda activate py-data
conda deactivate

Exit the current environment and return to the base.

conda deactivate
conda env list

List every conda environment with its location. The current env is highlighted with `*`.

-v paths under `~/.conda/envs`; --json

conda env list
conda env remove -n <name>

Delete an environment entirely.

-n <name>; -p <path>; --all; -y

conda env remove -n old-proj -y
conda env config vars set VAR=value

Set an environment variable that's auto-applied whenever the env is activated.

-n <name>; -p <path>

conda env config vars set -n py-data CUDA_VISIBLE_DEVICES=0
conda rename -n <old> <new>

Rename an environment (clones to a new name and removes the old one).

-n <old> <new>; -p <path> <new_path>; -d dry-run

conda rename -n py-data py-ml

Packages

conda install <pkg>

Install a package into the active (or `-n` named) environment.

-n <env>; -p <path>; -c <channel>; -y; --update-deps; --force-reinstall; --no-deps

conda install -n py-data numpy pandas
conda install -c conda-forge <pkg>

Install from the conda-forge community channel (broader catalogue than the default channel).

conda install -c conda-forge nodejs
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

Install PyTorch with GPU support from the PyTorch channel.

conda install pytorch-cuda=12.1 -c pytorch -c nvidia
conda install --file <requirements.txt>

Install every package listed in a `pip`-compatible requirements file via conda.

conda install --file requirements.txt
conda search <pkg>

Search the configured channels for a package; show version, build string, and channel.

-c <channel>; --info show package details; --platform; --json

conda search 'numpy>=2.0'
conda list

List every package installed in the active environment with build + channel.

-n <env>; -p <path>; --json; --export; --revisions show history

conda list --export > pkglist.txt
conda list --revisions

Show the history of `install / update / remove` actions — pair with `conda install --revision <N>` to roll back.

conda list --revisions
conda install --revision <N>

Roll the environment back to revision `<N>` (see `conda list --revisions`).

conda install --revision 3
conda remove <pkg>

Uninstall a package and its dependencies that are no longer needed.

-n <env>; -p <path>; -y; --all; --force

conda remove -n py-data scipy -y

Channels

conda config --add channels <ch>

Add a channel to `.condarc` (highest-priority last by default — reverse with `--prepend`).

-c <channel>; --prepend; --force

conda config --add channels conda-forge --prepend
conda config --remove channels <ch>

Remove a channel from `.condarc`.

conda config --remove channels conda-forge
conda config --show channels

Print the current channel priority list.

--json; --system; --env

conda config --show channels
conda config --set channel_priority strict|flex|disabled

Control how channels resolve conflicts. `strict` (default since Conda 23) = highest-priority channel wins entirely.

conda config --set channel_priority strict

Configuration

conda config --show

Print the merged configuration: ~/.condarc + system + env-scoped + CLI overrides.

--all; --json; --source; -v

conda config --show | grep -i ssl
conda config --set <key> <value>

Set a configuration key (anything you'd write in `.condarc`).

conda config --set auto_activate_base false
conda config --describe <key>

Show every allowed value and the default for a config key.

conda config --describe channel_priority
conda config --write-default

Write the default `.condarc` to the user home (overwriting without prompt).

conda config --write-default

Cache / Cleanup

conda clean --all

Remove tarballs, cached packages, lockfiles, and index cache to reclaim disk space.

-y; --packages; --index-cache; --tarballs; --locks; --source-cache

conda clean --all -y
conda clean --packages

Remove cached `.tar.bz2` / `.conda` archives (saves significant disk space).

conda clean --packages -y
conda clean --index-cache

Remove the cached channel index. The next command will re-download the index.

conda clean --index-cache -y

Build

conda build <recipe>

Build a conda package from a recipe directory (skeleton: conda skeleton pypi <name>).

<recipe>; --no-test; --no-build-id; -c <channel>; --output

conda build recipes/numpy

Misc

conda run -n <env> <cmd>

Run a command inside an environment without activating it — useful in CI scripts and cron jobs.

-n <env>; -p <path>; --cwd <dir>

conda run -n py-data pytest -x
conda doctor

Diagnose common issues: inconsistent env state, channel priority, lock files, etc.

-n <env>; --verbose; --fix-checks

conda doctor

Related command cheatsheets

About Conda

Conda is an open-source package and environment manager that first shipped in 2012 by Continuum Analytics (now Anaconda Inc). Conda was created for the Python data-science stack because pip + virtualenv couldn't install scientific libraries like NumPy, SciPy, scikit-learn, or PyTorch in a self-contained way — those packages bundle compiled C / Fortran / CUDA binaries that pip couldn't reliably resolve. Conda distributes pre-built packages for Python, R, Lua, Ruby, and most other language runtimes, and installs them into isolated environments. The current stable line is Conda 24+. The newer libmamba solver (`conda-libmamba-solver`, default since Conda 23.10) re-implements dependency resolution on top of the mamba C++ library, dropping resolution times from minutes to milliseconds. Common sibling tools include `mamba` (drop-in CLI replacement), `micromamba` (a single-binary installer used in CI / Docker), and `pixi` (next-generation Rust-based conda + lockfile manager). Conda is GPLv3-licensed; the Anaconda distribution adds a commercial tier for large organisations. By default Conda downloads from `repo.anaconda.com` and other configured channels; it does not upload your code.

Cheatsheet version 1.0.0