190

pip freeze shows me the packages installed, but how do I check against pypi which ones are outdated?

studiohack
  • 13,468
  • 19
  • 88
  • 118
Xster
  • 2,845
  • 5
  • 24
  • 19

8 Answers8

276

Since version 1.3, pip features a new command:

$ pip list --outdated
requests (Current: 1.1.0 Latest: 1.2.0)

See this post for more information.

Danilo Bargen
  • 3,379
  • 1
  • 22
  • 22
13

Thing is, I never upgrade all packages. I upgrade only what I need, because projects may break.

Because there was no easy way to upgrade package by package and update the requirements.txt file, I wrote pip-upgrader which also updates the versions in your requirements.txt file for the packages chosen (or all packages).

Installation

pip install pip-upgrader

Usage

Activate your virtualenv (important, because it will also install the new versions of upgraded packages in the current virtualenv).

cd into your project directory, then run:

pip-upgrade

Advanced usage

If the requirements are placed in a non-standard location, send them as arguments:

pip-upgrade path/to/requirements.txt

If you already know what package you want to upgrade, simply send them as arguments:

pip-upgrade -p django -p celery -p dateutil

If you need to upgrade to pre-release / post-release version, add --prerelease argument to your command.

Full disclosure: I wrote this package.

jkmartindale
  • 434
  • 1
  • 4
  • 11
8

Simple output:

pip list --outdated

enter image description here

See also docs on pip list --outdated option.

Pretty output:

pip install pip-check
pip-check

enter image description here

ZygD
  • 2,459
  • 12
  • 26
  • 43
Pikamander2
  • 715
  • 2
  • 8
  • 18
3

Use this pip fork:

https://github.com/dgladkov/pip

Which does exactly what you want using this command:

$ pip list --outdated
3

Perhaps pip-tools, available at https://github.com/nvie/pip-tools, might help you achieve what you want?

An example from the README:

$ pip-review --interactive
requests==0.14.0 available (you have 0.13.2)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit y
...
redis==2.6.2 available (you have 2.4.9)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit n
rq==0.3.2 available (you have 0.3.0)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit y
...
2
pip list --outdated | gawk -F ' ' 'NR>2{print$1}' | xargs pip install --upgrade

handy way to update all outdate package without install any extra package

alias pip-update='pip list --outdated | gawk -F ' ' 'NR>2{print$1}' | xargs pip install --upgrade'
DarkDiamond
  • 1,875
  • 11
  • 12
  • 19
B.V Beval
  • 21
  • 1
1

Similar to pip list --outdated but updates a requirements.txt file:

pur -r requirements.txt

PyPi: https://pypi.python.org/pypi/pur

GitHub: https://github.com/alanhamlett/pip-update-requirements

Alan Hamlett
  • 111
  • 2
0

Or you can

pip list --o

List installed packages, including editables. pip list

0m3r
  • 1,077
  • 10
  • 17