LinuxCommandLibrary

conda-export

Export Conda environment specifications

TLDR

Export the current environment details to stdout

$ conda export
copy

Export the current environment details to a YAML file
$ conda export [[-f|--file]] [path/to/environment.yaml]
copy

Export details in a specific format
$ conda export --format [environment-json|environment-yaml|explicit|json|reqs|requirements|txt|yaml|yml]
copy

Target an environment by name
$ conda export [[-n|--name]] [environment_name]
copy

Target an environment by its path
$ conda export [[-p|--prefix]] [path/to/environment]
copy

Include a specific channel
$ conda export [[-c|--channel]] [channel_name]
copy

SYNOPSIS

conda-export [-n NAME | -p PREFIX] [-f FILE] [--from-history] [--no-builds] [--no-pin-nopip] [--md5] [--no-deps] [--platform PLATFORM] [specs ...]

PARAMETERS

-h, --help
    Show help message and exit.

-n NAME, --name NAME
    Name of the environment to export.

-p PREFIX, --prefix PREFIX
    Full path to environment prefix (overrides -n).

-f FILE, --file FILE
    Output YAML file (default: environment.yml).

--from-history
    Export only packages from install history, ignoring extras.

--no-builds
    Omit build strings from package pins.

--no-pin-nopip
    Exclude pip-installed packages from pinning.

--md5
    Include MD5 hashes for all packages.

--no-deps
    Do not include dependencies in the export.

--platform PLATFORM
    Export for specific platform (e.g., linux-64).

DESCRIPTION

conda-export is a command-line tool designed to create highly reproducible exports of conda environments in YAML format. Unlike the standard conda env export, which may omit build strings or hashes, conda-export pins all packages with exact versions, build identifiers, and MD5 hashes where available. This ensures that recreating the environment on the same or different platforms yields identical results, addressing common reproducibility issues in scientific computing and data science workflows.

It scans the environment's package cache and metadata to include comprehensive pinning, supports platform-specific exports, and offers options to customize output like excluding pip-installed packages or dependencies. Ideal for sharing environments via files like environment.yml or integrating into CI/CD pipelines. Install via pip install conda-export or conda install -c conda-forge conda-export.

CAVEATS

Requires a conda environment with packages installed; may fail if metadata is corrupted. Not part of core conda—install separately. Large environments can produce verbose YAML files.

INSTALLATION

pip install conda-export
or
conda install -c conda-forge conda-export

EXAMPLE USAGE

conda-export -n myenv -f locked_env.yml --md5

HISTORY

Developed as part of the conda ecosystem (github.com/conda/conda-export), first released around 2020 to improve on limitations of conda env export. Maintained by conda-forge community for better reproducibility.

SEE ALSO

conda(1), mamba(1), pip-compile(1)

Copied to clipboard