conda-env
Manage Conda environments
TLDR
Create an environment from an environment file (YAML, TXT, etc.)
Delete an environment and everything in it
Update an environment based on an environment file
List all environments
View environment details
List environment variables
Set environment variables
SYNOPSIS
conda env <SUBCOMMAND> [options] [arguments]
PARAMETERS
create
Create a new environment from YAML file (--file) or package list
export
Export current environment spec to stdout or file (--file)
list
List all environments (default shows active with *)
remove
Delete environment(s) by name or prefix
clone
Duplicate environment (--clone-source for source)
--name
Environment name (e.g., myenv)
--prefix
Full path to environment directory
--file
YAML file with environment spec
--dry-run
Show actions without executing
--json
Output in JSON format
--help
Show help for command or subcommand
--version
Display conda version
DESCRIPTION
The conda env command is a powerful subcommand of Conda for creating, listing, exporting, removing, and cloning isolated environments. These environments encapsulate specific Python versions, packages, and dependencies, preventing conflicts across projects.
Ideal for data science, machine learning, and scientific computing, it supports reproducible setups via YAML files. For instance, environments can include non-Python packages like CUDA, R, or system libraries.
Unlike pip's virtualenv, Conda handles binary dependencies cross-platform (Linux, macOS, Windows). Activation switches shells to use the environment's binaries and Python. Common workflows involve creating from environment.yml, exporting for sharing, and cleaning up unused envs to save disk space.
Environments default to $CONDA_PREFIX/envs/<name>. Shared options like --name and --prefix apply across subcommands, with --dry-run for previews and --json for automation.
CAVEATS
Requires Conda installation (Anaconda/Miniconda). User must have write access to env directory. Activation modifies PATH; use conda init for shell integration. Large envs consume significant disk space.
ACTIVATION/DEACTIVATION
conda activate <name> or conda activate ./env
conda deactivate to exit
EXAMPLE USAGE
conda env create --file environment.yml
conda env export > environment.yml
conda env list
HISTORY
Introduced in 2012 with Conda 1.0 as part of Anaconda. Evolved in Conda 4.4 (2017) with environment.yml support and export enhancements. Now core to modern reproducible research workflows.
SEE ALSO
conda(1), mamba(1), virtualenv(1), pip(1)


