- Managing packages
- Searching for packages
- Installing packages
- Installing similar packages
- Installing packages from Anaconda.org
- Installing non-conda packages
- Installing commercial packages
- Viewing a list of installed packages
- Listing package dependencies
- Updating packages
- Preventing packages from updating (pinning)
- Adding default packages to new environments automatically
- Removing packages
- Managing Python
- Viewing a list of available Python versions
- Installing a different version of Python
- Installing PyPy
- Using a different version of Python
- Updating or upgrading Python
Managing packages
There are many options available for the commands described on this page. For details, see ../../commands .
Searching for packages
Use the terminal or an Anaconda Prompt for the following steps.
To see if a specific package, such as SciPy, is available for installation:
To see if a specific package, such as SciPy, is available for installation from Anaconda.org:
conda search --override-channels --channel defaults scipy
To see if a specific package, such as iminuit, exists in a specific channel, such as http://conda.anaconda.org/mutirri, and is available for installation:
conda search --override-channels --channel http://conda.anaconda.org/mutirri iminuit
Installing packages
Use the terminal or an Anaconda Prompt for the following steps.
To install a specific package such as SciPy into an existing environment «myenv»:
conda install --name myenv scipy
If you do not specify the environment name, which in this example is done by —name myenv , the package installs into the current environment:
To install a specific version of a package such as SciPy:
To install multiple packages at once, such as SciPy and cURL:
It is best to install all packages at once, so that all of the dependencies are installed at the same time.
To install multiple packages at once and specify the version of the package:
conda install scipy=0.15.0 curl=7.26.0
To install a package for a specific Python version:
conda install scipy=0.15.0 curl=7.26.0 -n py34_env
If you want to use a specific Python version, it is best to use an environment with that version. For more information, see Troubleshooting .
Installing similar packages
Installing packages that have similar filenames and serve similar purposes may return unexpected results. The package last installed will likely determine the outcome, which may be undesirable. If the two packages have different names, or if you’re building variants of packages and need to line up other software in the stack, we recommend using Mutex metapackages .
Installing packages from Anaconda.org
Packages that are not available using conda install can be obtained from Anaconda.org, a package management service for both public and private package repositories. Anaconda.org is an Anaconda product, just like Anaconda and Miniconda.
To install a package from Anaconda.org:
- In a browser, go to http://anaconda.org.
- To find the package named bottleneck, type bottleneck in the top-left box named Search Packages.
- Find the package that you want and click it to go to the detail page. The detail page displays the name of the channel. In this example it is the «pandas» channel.
- Now that you know the channel name, use the conda install command to install the package. In your terminal window or an Anaconda Prompt, run:
conda install -c pandas bottleneck
For information on installing packages from multiple channels, see Managing channels .
Installing non-conda packages
If a package is not available from conda or Anaconda.org, you may be able to find and install the package via conda-forge or with another package manager like pip.
Pip packages do not have all the features of conda packages and we recommend first trying to install any package with conda. If the package is unavailable through conda, try finding and installing it with conda-forge.
If you still cannot install the package, you can try installing it with pip. The differences between pip and conda packages cause certain unavoidable limits in compatibility but conda works hard to be as compatible with pip as possible.
Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately.
Conda environments replace virtualenv, so there is no need to activate a virtualenv before using pip.
It is possible to have pip installed outside a conda environment or inside a conda environment.
To gain the benefits of conda integration, be sure to install pip inside the currently active conda environment and then install packages with that instance of pip. The command conda list shows packages installed this way, with a label showing that they were installed with pip.
You can install pip in the current conda environment with the command conda install pip , as discussed in Using pip in an environment .
If there are instances of pip installed both inside and outside the current conda environment, the instance of pip installed inside the current conda environment is used.
To install a non-conda package:
- Activate the environment where you want to put the program:
- On Windows, in your Anaconda Prompt, run activate myenv .
- On macOS and Linux, in your terminal window, run conda activate myenv .
- To use pip to install a program such as See, in your terminal window or an Anaconda Prompt, run:
Installing commercial packages
Installing a commercial package such as IOPro is the same as installing any other package. In your terminal window or an Anaconda Prompt, run:
conda install --name myenv iopro
This command installs a free trial of one of Anaconda’s commercial packages called IOPro, which can speed up your Python processing. Except for academic use, this free trial expires after 30 days.
Viewing a list of installed packages
Use the terminal or an Anaconda Prompt for the following steps.
To list all of the packages in the active environment:
To list all of the packages in a deactivated environment:
Listing package dependencies
To find what packages are depending on a specific package in your environment, there is not one specific conda command. It requires a series of steps:
- List the dependencies that a specific package requires to run: conda search package_name —info
- Find your installation’s package cache directory: conda info
- Find package dependencies. By default, Anaconda/Miniconda stores packages in ~/anaconda/pkgs/ (or ~/opt/pkgs/ on macOS Catalina). Each package has an index.json file which lists the package’s dependencies. This file resides in ~anaconda/pkgs/package_name/info/index.json.
- Now you can find what packages depend on a specific package. Use grep to search all index.json files as follows: grep package_name ~/anaconda/pkgs/*/info/index.json
The result will be the full package path and version of anything containing the .
Example: grep numpy ~/anaconda3/pkgs/*/info/index.json
Output from the above command:
/Users/testuser/anaconda3/pkgs/anaconda-4.3.0-np111py36_0/info/index.json: numpy 1.11.3 py36_0 /Users/testuser/anaconda3/pkgs/anaconda-4.3.0-np111py36_0/info/index.json: numpydoc 0.6.0 py36_0 /Users/testuser/anaconda3/pkgs/anaconda-4.3.0-np111py36_0/info/index.json: numpy 1.11.3 py36_0
Note this also returned “numpydoc” as it contains the string “numpy”. To get a more specific result set you can add < and >.
Updating packages
Use conda update command to check to see if a new update is available. If conda tells you an update is available, you can then choose whether or not to install it.
Use the terminal or an Anaconda Prompt for the following steps.
- To update a specific package:
Conda updates to the highest version in its series, so Python 3.8 updates to the highest available in the 3.x series.
To update the Anaconda metapackage:
conda update conda conda update anaconda
Regardless of what package you are updating, conda compares versions and then reports what is available to install. If no updates are available, conda reports «All requested packages are already installed.»
If a newer version of your package is available and you wish to update it, type y to update:
Preventing packages from updating (pinning)
Pinning a package specification in an environment prevents packages listed in the pinned file from being updated.
In the environment’s conda-meta directory, add a file named pinned that includes a list of the packages that you do not want updated.
EXAMPLE: The file below forces NumPy to stay on the 1.7 series, which is any version that starts with 1.7. This also forces SciPy to stay at exactly version 0.14.2:
With this pinned file, conda update numpy keeps NumPy at 1.7.1, and conda install scipy=0.15.0 causes an error.
Use the —no-pin flag to override the update restriction on a package. In the terminal or an Anaconda Prompt, run:
Because the pinned specs are included with each conda install, subsequent conda update commands without —no-pin will revert NumPy back to the 1.7 series.
Adding default packages to new environments automatically
To automatically add default packages to each new environment that you create:
- Open Anaconda Prompt or terminal and run: conda config —add create_default_packages PACKAGENAME1 PACKAGENAME2
- Now, you can create new environments and the default packages will be installed in all of them.
You can also edit the .condarc file with a list of packages to create by default.
You can override this option at the command prompt with the —no-default-packages flag.
Removing packages
Use the terminal or an Anaconda Prompt for the following steps.
- To remove a package such as SciPy in an environment such as myenv:
conda remove -n myenv scipy
Managing Python
Conda treats Python the same as any other package, so it is easy to manage and update multiple installations.
Conda supports Python 3.8, 3.9, 3.10, and 3.11.
Viewing a list of available Python versions
To list the versions of Python that are available to install, in your terminal window or an Anaconda Prompt, run:
This lists all packages whose names contain the text python .
To list only the packages whose full name is exactly python , add the —full-name option. In your terminal window or an Anaconda Prompt, run:
conda search --full-name python
Installing a different version of Python
To install a different version of Python without overwriting the current version, create a new environment and install the second Python version into it:
- Create the new environment:
To create the new environment for Python 3.9, in your terminal window or an Anaconda Prompt, run:
conda create -n py39 python=3.9 anaconda
Note Replace py39 with the name of the environment you want to create. anaconda is the metapackage that includes all of the Python packages comprising the Anaconda distribution. python=3.9 is the package and version you want to install in this new environment. This could be any package, such as numpy=1.19 , or multiple packages .
Installing PyPy
To use the PyPy builds you can do the following:
conda config --add channels conda-forge conda config --set channel_priority strict conda create -n pypy pypy conda activate pypy
Using a different version of Python
To switch to an environment that has different version of Python, activate the environment .
Updating or upgrading Python
Use the terminal or an Anaconda Prompt for the following steps.
If you are in an environment with Python version 3.4.2, the following command updates Python to the latest version in the 3.4 branch:
The following command upgrades Python to another branch—3.8—by installing that version of Python. It is not recommended, rather it is preferable to create a new environment. The resolver has to work very hard to determine exactly which packages to upgrade. But it is possible, and the command is:
© Copyright 2017, Anaconda, Inc. Revision 08c7ed66 .