LinuxCommandLibrary

conda

package and environment manager for Python and data science

TLDR

Create environment

$ conda create -n [myenv] [python=3.11]
copy
Activate environment
$ conda activate [myenv]
copy
Install package
$ conda install [numpy]
copy
List environments
$ conda env list
copy
Export environment
$ conda env export > [environment.yml]
copy
Deactivate environment
$ conda deactivate
copy

SYNOPSIS

conda command [options]

DESCRIPTION

conda is a cross-platform package and environment management system originally developed for Python but extended to support R, Ruby, Lua, Scala, Java, JavaScript, C/C++, and other languages. Unlike pip which only manages Python packages, conda handles complete environments including system-level dependencies and compiled libraries, making it particularly valuable for scientific computing where native dependencies are common.
The environment isolation feature allows multiple projects with conflicting dependency requirements to coexist on the same system. Each conda environment is a directory containing a specific collection of packages, and switching between environments changes which packages are available. This is essential for data science workflows where different projects may require different versions of NumPy, TensorFlow, or other foundational libraries.
Conda distributes binary packages rather than building from source, which dramatically speeds up installation and eliminates compilation errors that plague pip-based workflows. The package ecosystem is organized into channels, with conda-forge being the largest community-maintained channel. conda is included in both Anaconda (a large distribution with 1500+ packages) and Miniconda (minimal installer with just conda and Python). The tool has become the de facto standard in data science, machine learning, and scientific computing communities.

PARAMETERS

create -n name

Create new environment
install package
Install package
update package
Update package
remove package
Remove package
list
List installed packages
search package
Search for package
env list
List environments
activate name
Activate environment
deactivate
Deactivate environment

CONFIGURATION

~/.condarc

User-level conda configuration file.
/opt/conda/.condarc
System-level conda configuration.
environment.yml
Environment specification file for reproducible environments.

ENVIRONMENT MANAGEMENT

$ # Create environment with Python
conda create -n myenv python=3.11

# Create with packages
conda create -n dataenv python=3.11 numpy pandas matplotlib

# Create from file
conda env create -f environment.yml

# Clone environment
conda create --clone myenv -n myenv_copy

# Remove environment
conda env remove -n myenv

# List all environments
conda env list
copy

PACKAGE MANAGEMENT

$ # Install package
conda install numpy

# Install specific version
conda install numpy=1.24.0

# Install from channel
conda install -c conda-forge package

# Update package
conda update numpy

# Update all packages
conda update --all

# Remove package
conda remove numpy
copy

ENVIRONMENT.YML

$ name: myenv
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.11
  - numpy
  - pandas
  - pip:
    - some-pip-package
copy

FEATURES

- Cross-platform
- Multiple language support
- Binary package distribution
- Dependency resolution
- Environment isolation
- Channel system
- Integration with pip

CAVEATS

Large disk space usage. Environment activation requires shell integration. Channel priority can cause confusion. Some packages only on conda-forge. Slower than pip for pure Python packages. Mixing conda and pip can cause issues.

HISTORY

Conda was created by Travis Oliphant and Peter Wang at Continuum Analytics (now Anaconda, Inc.) around 2012 for the Anaconda distribution.

SEE ALSO

pip(1), virtualenv(1), mamba(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community