Skip to main content

Command referenceconda env export

conda env export command (Linux & Windows / Conda)

Linux & WindowsCondapackagebeginner

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 / optionMeaning
-n, --nameExport a named environment instead of the active one.
-p, --prefixExport from a prefix path.
--from-historyExport only packages you explicitly installed.
--no-buildsOmit build strings for more portable YAML.
> file.ymlRedirect 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.

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.