Skip to main content

Command referenceconda env update

conda env update command (Linux & Windows / Conda)

Linux & WindowsCondapackageintermediate

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 / optionMeaning
-f, --fileYAML file describing the desired environment.
-n, --nameEnvironment name to update.
-p, --prefixEnvironment prefix to update.
--pruneRemove 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.

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.