Command referenceconda compare
conda compare command (Linux & Windows / Conda)
What it does
Compare packages between the active environment and another environment or package list file. When people look up conda compare environments, 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.
Compare packages between the active environment and another environment or package list file.
Syntax
conda compare [-n ENV | -p PATH] FILE_OR_ENV
Common options
| Flag / option | Meaning |
|---|---|
| FILE | A package list / environment export to compare against. |
| -n, --name | Compare using a named environment as the baseline. |
| -p, --prefix | Compare using a prefix as the baseline. |
Practical examples
Diff against YAML export
conda compare environment.yml
Shows packages that differ from the active environment.
Named baseline
conda compare -n prod environment.yml
Compares the prod environment to a file.
Two exports
conda compare -n prod exported-prod.yml
Highlights package drift between prod and a saved export.
Common mistakes
- Comparing environments from different platforms and treating every difference as an error.
- Passing a full YAML with channels/name keys when a simple package list was expected.
Related commands
- conda env exportExport the active (or named) environment to a YAML or explicit package lock for sharing.
- conda listList packages installed in the active or named Conda environment.
- conda env updateUpdate an existing environment to match packages listed in a YAML file.
- conda createCreate a new isolated Conda environment with an optional Python version and starter packages.
- conda activateActivate a named or path-based Conda environment in the current shell session.
- conda installInstall packages into the active or named Conda environment from configured channels.
- conda env listList all Conda environments and mark the currently active one.
- aptSearch, install, update, and remove packages on Debian-based systems.
FAQ
What does conda compare do in Conda?
Compare packages between the active environment and another environment or package list file.
Does conda compare 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 compare example?
Try `conda compare environment.yml` — Shows packages that differ from the active environment.
Is mamba the same as conda compare?
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.