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 command [options] [arguments]

Examples:
conda install numpy
conda create --name myenv python=3.9
conda activate myenv

PARAMETERS

-h, --help
    Show help message and exit.

-V, --version
    Show the conda version number and exit.

-y, --yes
    Do not ask for confirmation for actions.

--json
    Report all output as JSON, useful for scripting.

-c channel, --channel channel
    Specify additional channels to search for packages.

-n env, --name env
    Specify the name of the environment to operate on.

-p path, --prefix path
    Specify the path to the environment prefix.

--dry-run
    Perform a dry run; only display what would have been done.

DESCRIPTION

conda is an open-source, cross-platform package, dependency, and environment management system. It's language-agnostic, supporting Python, R, Java, C/C++, and more. Developed by Anaconda, Inc., conda solves the challenge of dependency hell by allowing users to create isolated environments, each with its own set of packages and their specific versions. This prevents conflicts between different projects requiring conflicting package versions.

Unlike pip, which primarily manages Python packages, conda manages non-Python dependencies as well, making it ideal for scientific computing and data science workflows where many tools are written in various languages. It automatically handles package installation, updates, and removal, ensuring all necessary dependencies are met.

conda facilitates reproducible research and development by enabling users to easily share and recreate specific environments. It's the default package manager for Anaconda and Miniconda distributions, widely adopted for its robust capabilities in managing complex software stacks.

CAVEATS

conda environments and caches can consume significant disk space, especially with many environments or large packages. Dependency resolution can sometimes be slow or lead to complex conflicts if channel priorities are not managed carefully or if mixing packages from various sources. While powerful, conda requires users to understand environment activation/deactivation and channel management for optimal use. It is not a system-level package manager like apt or yum.

CHANNEL MANAGEMENT

conda uses 'channels' to find packages. By default, it uses the 'defaults' channel. However, many packages are available on 'conda-forge', a community-driven channel. Users can add channels using conda config --add channels channel_name. The order of channels in the configuration determines priority for dependency resolution, which is crucial for managing complex environments.

HISTORY

conda was first released in 2012 by Continuum Analytics (now Anaconda, Inc.). It was initially developed to manage Python packages and dependencies for scientific computing, particularly to address the challenges of dependency hell and provide isolated, reproducible environments. Over time, its capabilities expanded to include packages from other programming languages (R, C/C++, Java, etc.), making it a versatile cross-platform package manager. It has since become the cornerstone of the Anaconda and Miniconda distributions, widely adopted in data science and machine learning communities.

SEE ALSO

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

Copied to clipboard