Last updated: Apr 10, 2024
Reading time·3 min

Use the conda install package=version command to install a specific version
of a package using conda, e.g. conda install scipy=1.9.1.
You can also install a package version of at least X or a version not greater than Y by wrapping the name of the package and the version in quotation marks.
conda install scipy=1.9.1 # 👇️ Install scipy version 1.7.1 or higher conda install "scipy>=1.7.1" # 👇️ Install scipy version prior to 1.7.1 conda install "scipy<1.7.1"

conda install package=version.You can also specify the environment when installing a specific version of the package.
Use the conda env list command to list your environments.
conda env list

Use the --name option to specify the environment when installing the package.
conda install --name myenv scipy=1.9.1

Here is an example of installing at least version 1.7.1 of scipy.
conda install "scipy>=1.7.1"
Note that the package name and version are wrapped in double quotes.
Quotation marks must be used when the specification contains a space or any of
the following characters: <, >, |, *.
Something you might commonly have to do is install the version of a package before version X.
conda install "scipy<1.7.1"

If you want to not be prompted for confirmation when installing a package, use
the -y option.
conda install -y "scipy<1.7.1"
You can
list all available package versions
with the conda search -f <package> command.
conda search -f scipy
You can also search for a specific version of a package.
conda search "scipy>1.7"
scipy that are greater than version 1.7.You can also specify a version range of the package to be installed using
conda.
conda install "scipy>=1.7,<1.9"

The command installs version 1.7, 1.8, but not 1.9.
Notice that there is a comma between the two versions.
You can also use the OR operator to install version X or version Y.
conda install "scipy=1.9.1|1.9.2"

The command installs version 1.9.1 or version 1.9.2 of scipy.
I've also written a detailed guide on how to pip install a specific version of a Python package.
You can learn more about the related topics by checking out the following tutorials: