Friday, December 12, 2014

Upgrading all install packages with pip

See upgrades available
The following commands will show all the packages which have an upgrade available.

$ pip list --outdated
argparse (Current: 1.2.1 Latest: 1.2.2)
astroid (Current: 1.2.1 Latest: 1.3.2)
ipython (Current: 2.3.0 Latest: 2.3.1)

$pip freeze | cut -d = -f 1 | xargs -n 1 pip search | grep -B2 'LATEST:'
(standard input)-4-argparse                  - Python command-line parsing library
(standard input)-5-  INSTALLED: 1.2.1
(standard input):6:  LATEST:    1.2.2
--
(standard input)-42-astroid                   - An abstract syntax tree for Python with inference support.
(standard input)-43-  INSTALLED: 1.2.1
(standard input):44:  LATEST:    1.3.2
--
(standard input)-48-ipython                   - IPython: Productive Interactive Computing
(standard input)-49-  INSTALLED: 2.3.0
(standard input):50:  LATEST:    2.3.1

Upgrade all packages
Use this command to install all the installed packages using pip.

pip install -U `pip list --outdated | awk '!/Could not|ignored/ { print $1}'`