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
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 theconda 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:
Specifying an environment
If no environment is specified in the command, conda installs the requested package(s) in your currently active environment.
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.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 version2.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.
Where is my package cache?
Where is my package cache?
Your package cache is located in the
/pkgs
folder of your installation folder. Possible default installation locations include:Operating System | Installer | File Location |
---|---|---|
Windows | Graphical installer (.exe ) | \Users\<USERNAME>\anaconda3\ |
macOS | Graphical installer (.pkg ) | /opt/anaconda3/ |
macOS | Command line installer (.sh ) | /anaconda3/ |
Linux | Command line installer (.sh ) | /anaconda3/ |
Replace
To see your exact package cache file location, open Anaconda Prompt (Terminal in macOS/Linux) and run the following command:
anaconda3
with miniconda3
for Miniconda installationsTo see your exact package cache file location, open Anaconda Prompt (Terminal in macOS/Linux) and run the following command:
How do I know what file type a package is?
How do I know what file type a package is?
One way to determine what archive file type a package install uses is to use the The extension in the file name and url for each package version shows what type of file will be downloaded:
--info
flag when searching for the package:Example package information
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
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.