Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check version of pip packages available before installing [duplicate]

Tags:

python

pip

I want to know what version of a package pip has available before I install it. I understand that you can check the version of the packages you have installed with "pip show" but I want to check which package versions pip has available in its archive. And then once I identify them, how do you pick a specific one to install?

like image 998
jelijelidjango Avatar asked Sep 21 '14 10:09

jelijelidjango


People also ask

How do I check pip package version?

Method 1: pip show To check which version of a given package is installed, use the pip show <your_package> command. For example, to check the version of your NumPy installation or virtual environment, run pip show numpy in your command line or Powershell (Windows), or terminal (macOS and Linux/Ubuntu).

How do I select what version of pip to install?

To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

Which of the following commands would you use to check pip version?

When you run the pip list command in your environment, pip displays the specific version number that you've installed for each package. To get more information about a specific package, you can look at the package's metadata by using the show command in pip : Windows.


2 Answers

pip install --use-deprecated=legacy-resolver foobar==

--use-deprecated=legacy-resolver is required after pip 20.3

To see all versions, install a nonexistent version, which can be the empty string. [thanks @ChrisMontanaro, @JanKyuPeblik]

$ pip install --use-deprecated=legacy-resolver numpy== ERROR: Could not find a version that satisfies the requirement numpy==  (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2,  1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2,  1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2,  1.11.3, 1.12.0, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3,  1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6,  1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1,  1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6,  1.17.0rc1, 1.17.0rc2, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5,  1.18.0rc1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0rc1,  1.19.0rc2, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0rc1,  1.20.0rc2, 1.20.0, 1.20.1, 1.20.2) ERROR: No matching distribution found for numpy==  

Then you can install one of them:

$ pip install numpy==1.20.2 Collecting numpy==1.20.2   Downloading numpy-1.20.2-cp38-cp38-win_amd64.whl (13.7 MB)      |████████████████████████████████| 13.7 MB 6.4 MB/s Installing collected packages: numpy Successfully installed numpy-1.20.2 

The p==x Requirement Specifier means install package p version x.

like image 156
Bob Stein Avatar answered Sep 22 '22 17:09

Bob Stein


For newer versions of pip as of Dec 2020, you should use:

pip download -v packagename 

For older versions of pip you can use:

pip install --download . -v packagename 

Both above commands will download the files without installing and will also show all the version of a package (you can stop the command after that). After that, to install a specific version use:

pip install packagename==version 
like image 30
enrico.bacis Avatar answered Sep 23 '22 17:09

enrico.bacis