Command referenceconda env update
conda env update command (Linux & Windows / Conda)
What it does
Update an existing environment to match packages listed in a YAML file. When people look up conda env update, 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.
Update an existing environment to match packages listed in a YAML file.
Syntax
conda env update [-n ENV | -p PATH] -f FILE [--prune]
Common options
| Flag / option | Meaning |
|---|---|
| -f, --file | YAML file describing the desired environment. |
| -n, --name | Environment name to update. |
| -p, --prefix | Environment prefix to update. |
| --prune | Remove packages not listed in the file. |
Practical examples
Apply YAML changes
conda env update -n web -f environment.yml
Installs or upgrades packages so the env matches the file.
Prune extras
conda env update -n web -f environment.yml --prune
Also removes packages that are no longer in the YAML.
Active env
conda env update -f environment.yml
Updates whichever environment is currently active.
Common mistakes
- Forgetting `--prune` and wondering why old packages remain.
- Updating the wrong named environment when several project YAMLs exist.
Related commands
- conda env createCreate an environment from an environment.yml (or similar) specification file.
- conda env exportExport the active (or named) environment to a YAML or explicit package lock for sharing.
- conda updateUpdate Conda packages (or Conda itself) to newer compatible versions.
- conda installInstall packages into the active or named Conda environment from configured channels.
- 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 listList packages installed in the active or named Conda environment.
- conda env listList all Conda environments and mark the currently active one.
FAQ
What does conda env update do in Conda?
Update an existing environment to match packages listed in a YAML file.
Does conda env update 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 update example?
Try `conda env update -n web -f environment.yml` — Installs or upgrades packages so the env matches the file.
Is mamba the same as conda env update?
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.