LinuxCommandLibrary

conda

Manage Conda environments and packages

TLDR

Create a new environment, installing named packages into it

$ conda create [[-n|--name]] [environment_name] [python=3.9 matplotlib]
copy

List all environments
$ conda info [[-e|--envs]]
copy

Activate an environment
$ conda activate [environment_name]
copy

Deactivate an environment
$ conda deactivate
copy

Delete an environment (remove all packages)
$ conda remove [[-n|--name]] [environment_name] --all
copy

Install packages into the current environment
$ conda install [python=3.4 numpy]
copy

List currently installed packages in current environment
$ conda list
copy

Delete unused packages and caches
$ conda clean [[-a|--all]]
copy

SYNOPSIS

conda [global_options] [SUBCOMMAND] [subcommand_options] [args]

PARAMETERS

--help (-h)
    Show help and exit

--version (-V)
    Display conda version

--dry-run (-d)
    Show actions without executing

--json
    Output in JSON format

--quiet (-q)
    Minimal output

--verbose (-v)
    Increase verbosity

clean
    Remove unused packages and caches

config
    Modify or view configuration values

create
    Create a new conda environment

info
    Display information about current conda

init
    Initialize conda for shell activation

install
    Install packages into environment

list
    List packages in current environment

remove
    Remove packages from environment

search
    Search available packages

update
    Update packages to latest compatible versions

DESCRIPTION

Conda is an open-source, cross-platform package and environment management system designed primarily for Python but supporting multiple languages including R, Ruby, Lua, Scala, Java, C/C++, and more. It manages complex dependencies, including non-Python libraries, by distributing pre-compiled binaries, avoiding compilation issues common with tools like pip.

Key strengths include creating isolated, reproducible environments to prevent conflicts between projects—essential for data science, machine learning, and scientific computing. Users define environments via YAML files for easy sharing.

On Linux, install via Miniconda (lightweight) or Anaconda (full distribution with 250+ packages). Common workflow: conda create -n myenv python=3.9, conda activate myenv, conda install numpy pandas. Channels like conda-forge provide community packages. Conda's solver handles dependency graphs, though it can be slow on large sets.

Unlike system package managers, conda operates user-space without root privileges, making it portable across machines.

CAVEATS

Dependency solving can be slow for complex environments; use mamba for faster C-based solver. Requires conda init for shell integration. Not a system package manager—use alongside apt or yum. Large installs increase disk usage.

CHANNELS

Packages sourced from channels like defaults or conda-forge. Add with conda config --add channels conda-forge; prioritize with --channel-priority strict.

ENVIRONMENTS

Activate with conda activate envname; deactivate with conda deactivate. Export: conda env export > environment.yml; recreate: conda env create -f environment.yml.

HISTORY

Released in 2012 by Continuum Analytics (now Anaconda, Inc.) as part of Anaconda Distribution. Evolved from binstar.org tool; gained popularity in scientific Python ecosystem. Version 4.0 (2016) introduced environments; now at 23.x with improved solver and multi-language support.

SEE ALSO

pip(1), mamba(1), apt(8), dnf(8)

Copied to clipboard