0

Similar to how we can run npm show {package} version to get the latest version available for any npm package, is there an equivalent command for pip/python?

I don't necessarily want to upgrade to that version, I would just like to be able to output the latest version number available for any package.

Ayush W
  • 73
  • 1
  • 8

3 Answers3

2

This command just shows the available versions of pip package, if I correctly understand your question.

python -m pip install --upgrade pip==

or to see any package versions:

pip install package_name==

P.s. Yes there will be an error, that says no match)

  • 2
    This is pretty clever, to get the answer without another package. You can then get the latest version with: `python -m pip install --upgrade figgypy== 2>&1 | grep "from versions:" | sed "s/^.*from versions: \(.*\))/\1/" | awk -F ", " '{print $NF}'`. – theherk Jan 13 '22 at 08:46
  • 1
    @theherk Totally agree – Firdavsbek Narzullaev Jan 13 '22 at 08:50
  • 1
    Wow that's crafty, that was exactly what I was looking for, thank you! This way also seems to be consistently faster than using yolk3k, aside from not needing another package as well. – Ayush W Jan 13 '22 at 09:15
  • Interesting edge case to look out for: if your current version of the package resolves to 0 (i.e 0.0.0, 0.0), the command `python -m pip install --upgrade {package}==` will not produce an error and therefore will not work. Potentially use `python -m pip install --upgrade {package}==-` instead to ensure the version can't be satisfied and will always produce an error. – Ayush W Jan 13 '22 at 16:59
  • Another edge case is that the pip error message does not contain the list of all the package versions when pip is version 21.0 – Ayush W Jan 20 '22 at 19:24
1

You can use yolk3k as in this answer.

➜ pip install yolk3k
➜ yolk -V figgypy
figgypy 1.1.9
theherk
  • 5,196
  • 3
  • 27
  • 46
0

List outdated packages with the installed and the latest versions:

pip list --outdated

See the docs.

phd
  • 69,888
  • 11
  • 97
  • 133