LinuxCommandLibrary

conda-install

Install packages into conda environments

TLDR

Install one or more package into the currently active conda environment

$ conda install [package1 package2 ...]
copy

Install a single package into the currently active conda environment using channel conda-forge
$ conda install [[-c|--channel]] conda-forge [package]
copy

Install a single package into the currently active conda environment using channel conda-forge and ignoring other channels
$ conda install [[-c|--channel]] conda-forge --override-channels [package]
copy

Install a specific version of a package
$ conda install [package]=[version]
copy

Install a package into a specific environment
$ conda install [[-n|--name]] [environment] [package]
copy

Update a package in the current environment
$ conda install --upgrade [package]
copy

Install a package and agree to the transactions without prompting
$ conda install [[-y|--yes]] [package]
copy

SYNOPSIS

conda install [options] [package_spec ...]

PARAMETERS

package_spec
    One or more package specifications to install. This can include version constraints (e.g., numpy=1.20, 'python>=3.8,<3.9').

-n ENVIRONMENT, --name ENVIRONMENT
    Install packages into a specific environment by its name. If not specified, packages are installed into the current active environment.

-p PATH, --prefix PATH
    Install packages into a specific environment by its absolute path.

-c CHANNEL, --channel CHANNEL
    Specify an additional channel to search for packages. Can be used multiple times. E.g., conda-forge.

--override-channels
    Ignore the channels specified in your .condarc file and only use those provided with -c.

-y, --yes
    Do not ask for confirmation before executing the installation.

--no-deps
    Do not install dependencies. Useful for very specific cases, but generally not recommended.

--force-reinstall
    Force reinstall of all packages, even if they are already installed and up-to-date.

--file FILE
    Read package specifications from a file, one per line. Useful for reproducible environments.

DESCRIPTION

The conda install command is a fundamental utility within the Conda package management system, used to install new packages into a specified or currently active Conda environment. Unlike traditional system-level package managers, Conda is language-agnostic, capable of managing packages for Python, R, Ruby, Java, and more, along with their non-language-specific dependencies.

conda install excels at resolving complex dependency trees, ensuring that all necessary libraries and their compatible versions are installed without conflicts. It leverages "channels" (repositories where packages are stored) to find and download packages. This command is crucial for creating isolated development environments, allowing users to manage different sets of software versions for various projects without interfering with each other.

CAVEATS

When using conda install, be mindful of channel priority and potential dependency conflicts. Using --override-channels or specifying multiple channels can sometimes lead to unexpected package versions if not managed carefully. Always ensure your desired environment is activated before installing packages to avoid installing into the base environment unintentionally.

CONDA CHANNELS

Conda packages are distributed via "channels," which are URLs to package repositories. The default channel is repo.anaconda.com/pkgs/main. Popular community channels like conda-forge offer a vast array of additional packages. The order of channels matters for dependency resolution unless --strict-channel-priority is used.

ENVIRONMENT MANAGEMENT

While conda install adds packages, it's typically used in conjunction with conda create to first establish an isolated environment. Activating the environment (e.g., conda activate myenv) before installing ensures packages are confined to that specific environment, preventing global system pollution and enabling project-specific dependency sets.

HISTORY

Conda was developed by Continuum Analytics (now Anaconda Inc.) starting around 2012, primarily to address the challenges of package and environment management in scientific computing, especially for Python and R. It was designed to be platform-agnostic and handle complex binary dependencies that traditional language-specific package managers often struggled with. The conda install command has been a core component since its inception, continually evolving to improve dependency resolution and channel management capabilities.

SEE ALSO

conda create(1), conda update(1), conda remove(1), conda env(1), pip(1)

Copied to clipboard