LinuxCommandLibrary

conda-compare

Compare two Conda environments

TLDR

Compare packages in the current directory to packages from the file file.yml

$ conda compare file.yml
copy

Compare packages in environment named myenv to packages from the file file.yml
$ conda compare [[-n|--name]] myenv [path/to/file.yml]
copy

Compare packages in environment myenv at custom path (i.e. prefix) to packages from the file file.yml
$ conda compare [[-p|--prefix]] [path/to/myenv] [path/to/file.yml]
copy

Display help
$ conda compare [[-h|--help]]
copy

SYNOPSIS

conda-compare [OPTIONS] ENV_SPEC1 [ENV_SPEC2]

PARAMETERS

--format {console,yaml,json}
    Output format. [default: console]

--keys KEY1[,KEY2,...]
    Keys to compare. [default: name,version,build]

--diff-only
    Only output specs that differ

--summary
    Show a summary of the comparison

--color
    Force color output

--no-color
    Disable color output

--version
    Show the version and exit

--help
    Show this message and exit

DESCRIPTION

conda-compare is a command-line tool for comparing two conda environments or specification files, such as environment.yml. It identifies differences in packages, versions, builds, and channels, aiding in debugging, migration, and change tracking.

Users specify two inputs—environment directories or YAML files—and receive a structured diff. Outputs include human-readable console diffs with color coding, YAML, or JSON for scripting. Key customization via --keys focuses comparison on attributes like name, version, or build. Modes like --diff-only hide matches, while --summary provides stats on added, removed, or changed packages.

Ideal for CI/CD, team collaboration, or ensuring reproducibility across systems. Handles pinned specs and extras. Installed via conda-forge, it integrates seamlessly with conda workflows without core dependencies.

CAVEATS

Third-party tool; install via conda install -c conda-forge conda-compare. Inputs must be valid env dirs or YAML files.

INSTALLATION

conda install -c conda-forge conda-compare

EXAMPLES

conda-compare ~/env1 ~/env2
conda-compare --diff-only --summary env1.yml env2.yml

HISTORY

Released ~2020 on conda-forge; actively maintained for conda ecosystem compatibility.

SEE ALSO

conda(1), mamba(1)

Copied to clipboard