Quick Reference · cross-language package & environment manager

conda cheat sheet

Almost every conda command moves a package along one line: from a channel on the internet, into your local package cache, linked into an environment, and put on PATH by your shell. Learn that line once and the flags stop being arbitrary.

channel / remote package cache environment (prefix) shell / session destructive most common

Distilled & cross-checked against: docs.conda.io (official cheatsheet + concepts) · conda-forge.org · anaconda.com/docs · github.com/conda-forge/miniforge · conda.org (CEP-29 MatchSpec) · bioconda · readthedocs conda guide. Verified 2026-08-26 against conda 26.7.0.

The four places & the commands that move packages between them
Channel conda-forge, defaults… serves repodata.json conda config --show-sources Package Cache ~/miniconda3/pkgs downloaded once, shared conda clean --all Environment envs/NAME (the "prefix") hard-links, not copies conda list Shell env's bin/ prepended to PATH (base) → (myenv) which python download link activate conda install conda deactivate conda remove conda clean THE INTERNET YOUR MACHINE
01Install & Verifyonce per machine
02Create Environmentsone per project
03Activate & Runthe daily loop
04Install Packagesinto the active env
05Version & Build SpecsMatchSpec
06Inspect & Searchread the env
07Update & Removemind the difference
08Channels & .condarcwhere packages come from
09Exporttwo different jobs
10Import & Recreatethe other half
11pip Inside Condaorder matters
12Revisions & Repairundo a bad solve
13Disk & Speedhousekeeping
Naming an Environmentanywhere you see ENVNAME

The five things that actually confuse people

Not more commands — the models underneath them.

What conda install really does

A solve is not a download. Conda reads your channel list in priority order, fetches each channel's index, and only then goes shopping — recursively, for every dependency.

1 · READ channels, in priority order 2 · FETCH repodata.json (the whole index) 3 · SOLVE search top channel first, then down 4 · FETCH download to cache, link into env 5 · REPEAT for every dependency every dependency re-enters the solve — this is why big envs are slow CONFIG SOLVER (libmamba) RECURSION

channel_priority: strict vs flexible vs disabled

The single biggest source of broken conda environments. Suppose conda-forge sits above defaults, and both ship some-pkg — conda-forge at 1.0, defaults at 1.2.

YOUR CHANNEL LIST 1. conda-forge some-pkg 1.0 2. defaults some-pkg 1.2 higher in the list = higher priority strict RECOMMENDED lower channels are invisible for a name install some-pkg → 1.0 install some-pkg=1.2 → fails no ABI mixing. ever. flexible CURRENT DEFAULT drops to a lower channel only if it must install some-pkg → 1.0 install some-pkg=1.2 → 1.2, from defaults quietly mixes channels disabled HERE BE DRAGONS channels are equal; newest version wins install some-pkg → 1.2, from defaults install some-pkg=1.2 → 1.2 binary incompatibility risk

Anatomy of a package spec

Three optional fields hang off the package name. Getting = vs == wrong is the most common pinning bug in a shared environment.yml.

conda-forge :: pytorch = 2.4 = cuda* CHANNEL · optional same as -c conda-forge NAME · required the only mandatory field VERSION · optional omit it and you get "newest" BUILD STRING · optional how it was compiled: cuda*, py311* =2.4 fuzzy → any 2.4.x · ==2.4.1 exact → that release only · ">=1.8,<2" AND · "1.8|2.0" OR · always quote < > * |

conda + pip: the one rule

Conda tracks what conda installed. It cannot see pip's files — so pip goes last, or not at all.

✓ SAFE conda create conda install ×N pip install export pip is the last thing to touch the env. ✗ BROKEN conda install pip install conda install clobbers Conda re-solves and may overwrite files pip put there. The env drifts into an unreproducible state. Fix: don't repair it — rebuild the env from the file.

Anatomy of environment.yml

The file you should commit. Channel order is priority order, and the pip: block must come last.

name: myproject channels: - conda-forge # highest priority - nodefaults # opt out of `defaults` dependencies: - python=3.12 # fuzzy: any 3.12.x - numpy>=1.26 - pytorch=2.4=cuda* # pin the build too - pip # pip itself must be a dep - pip: # ← LAST. always. - some-pypi-only-pkg==1.2.0

Create: conda env create -f environment.yml
Sync: conda env update -f environment.yml --prune

Which installer? conda is the tool — these are the ways to get it

They all give you the same conda command. They differ in what's preinstalled and which channel is wired in by default.

Anaconda the full distribution size · several GB, 600+ pkgs channel · defaults (Anaconda) mamba · no Best for: teaching, day one, "just give me everything". ⚠ commercial ToS may apply Miniconda minimal, from Anaconda size · ~100 MB channel · defaults (Anaconda) mamba · solver only (libmamba) Best for: you want conda and nothing else. Docker-friendly. ⚠ same ToS caveat as above Miniforge minimal, from conda-forge size · ~100 MB channel · conda-forge only mamba · yes, bundled Best for: most people, most days. ARM/Apple Silicon, HPC. ✓ fully open source · Mambaforge is retired micromamba not conda at all — a clone size · one static binary, ~5 MB channel · conda-forge base env · none. no Python. Best for: CI, Docker layers, anywhere startup cost matters. reads the same .condarc

Worth memorizing

= vs ==one equals is fuzzy (=1.261.26.*); two is exact
install ≠ updateupdate stays inside the major version; install takes the newest
pip goes lastconda after pip can silently clobber pip's files
strict prioritythe fix for 90% of "unsatisfiable" and ABI errors
never touch basebase holds conda itself — one broken solve there bricks everything
-n vs -pname (shared envs dir) vs prefix (any path, project-local)
--from-historythe portable export; plain env export pins builds to your OS
--explicita real lockfile: exact URLs, no solve, same-platform only
quote your specsthe shell eats < > * | before conda ever sees them
list --revisionsconda has an undo — install --revision N
one env per projectenvs are hard-linked, so they're far cheaper than they look
clean --allsafe: it only drops cache entries no env is linking to