Installing conda packages
A conda package is a file that installs a specific software library or tool into a conda environment, along with any required dependencies. You can install packages from sources like Anaconda’s public repository, Anaconda.org, or conda-forge. For more information about installing packages, see the official conda documentation.
Because conda is a command-line tool, this page outlines the most common workflows for installing packages in your environment using Anaconda Prompt (Terminal for macOS/Linux users). If you prefer to use a graphical interface, you can also perform these actions using Anaconda Navigator.
Anaconda strongly recommends creating separate conda environments for each of your projects. This protects your base
environment from breaking due to complex package dependency conflicts, helps to simplify environment management, and aids in the reproducibility of your environment on other machines.
Using conda install
Use the conda install
command to install packages into an environment. Run conda install --help
to see a list of available options.
To install a single package, run the following command:
To install a single package, run the following command:
To install multiple packages, list the packages separated by a space:
Specifying an environment
If no environment is specified in the command, conda installs the requested package(s) in your currently active environment.
To install a package in an environment that is not your currently active environment, specify the environment name:
Specifying a channel
By default, conda installs packages using the channel priorities defined in your .condarc
configuration file. You can override this behavior in one of two ways, depending on how you want conda to handle the package dependencies:
Using the double-colon syntax ::
in the command installs the specified package from the specified channel, but immediately falls back to your user-defined channel priorities to install any necessary package dependencies.
Using the double-colon syntax ::
in the command installs the specified package from the specified channel, but immediately falls back to your user-defined channel priorities to install any necessary package dependencies.
Using the --channel
flag in the command installs the specified package and as many dependencies as possible from the specified channel before falling back to your user-defined channel priorities.
Specifying package versions
By default, when installing packages from the command line, conda retrieves the latest possible versions of the requested package(s) (and their dependencies) that are compatible with the current environment. To define package versions, conda uses MatchSpec as its query language. MatchSpec also allows for wildcard characters and match ranges. For more information, see the official conda documentation on match specifications.
Here is an example command that installs NumPy version 2.2.2
and its dependencies:
Downloading a package file
Conda downloads package archive files (.conda
or .tar.bz2
) to your package cache when you install a new package. This makes conda more efficient when you need to use the same package in multiple places, but it also enables you to copy or use the package archive file in different ways.
Some uses for package archive files include offline installing of packages onto an air-gapped machine or the creation of custom channels for local or network file system use. For more information on creating custom channels, see Creating custom channels in the official conda documentation.
To download a package file without installing the package, run the following command:
This command downloads the package file to your package cache without installing it to your currently-active environment.
Installing packages from a local file (air-gapped networks)
If you’re working on a machine without internet access, you can install packages in an environment directly from .conda
or .tar.bz2
files that are stored on your local file system:
If conda can’t find the file, try using an absolute path instead of a relative one.
Conda supports both .conda
and .tar.bz2
file types, but .conda
archive files are the most common. For more information on the .conda
file format, see .conda file format in the official conda documentation.
Installing a package directly from a local file does not resolve its dependencies. If your installed package does not work, you might have missing dependencies that need to be resolved manually.