Command referenceconda env export
conda env export command (Linux & Windows / Conda)
What it does
Export the active (or named) environment to a YAML or explicit package lock for sharing. When people look up conda env export, 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.
Export the active (or named) environment to a YAML or explicit package lock for sharing.
Syntax
conda env export [-n ENV | -p PATH] [options]
Common options
| Flag / option | Meaning |
|---|---|
| -n, --name | Export a named environment instead of the active one. |
| -p, --prefix | Export from a prefix path. |
| --from-history | Export only packages you explicitly installed. |
| --no-builds | Omit build strings for more portable YAML. |
| > file.yml | Redirect stdout to an environment.yml file. |
Practical examples
Shareable YAML
conda env export --no-builds > environment.yml
Writes a portable environment file for teammates.
History-only
conda env export --from-history > environment.yml
Keeps the file smaller by listing only requested packages.
Named env
conda env export -n ml > ml.yml
Exports ml without activating it first.
Explicit lock
conda list --explicit > spec-file.txt
Pairs with recreate workflows that need exact builds (see conda list).
Common mistakes
- Committing platform-specific build strings that fail on another OS — prefer `--no-builds` or `--from-history` for cross-OS sharing.
- Exporting base by accident when a project env was not activated.
Related commands
- conda env createCreate an environment from an environment.yml (or similar) specification file.
- conda env updateUpdate an existing environment to match packages listed in a YAML file.
- conda listList packages installed in the active or named Conda environment.
- 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 env export do in Conda?
Export the active (or named) environment to a YAML or explicit package lock for sharing.
Does conda env export 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 env export example?
Try `conda env export --no-builds > environment.yml` — Writes a portable environment file for teammates.
Is mamba the same as conda env export?
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.