Coder Perfect

With pip, you can see which version of a package is installed.

Problem

Is it feasible to determine which version of a package is presently installed using pip?

I’m familiar with pip install XYZ —upgrade, but I’m curious if pip info XYZ exists. If not, what is the most accurate way to determine which version I am now using?

Asked by Alexis

Solution #1

There is a pip display command in pip 1.3.

$ pip show Jinja2
---
Name: Jinja2
Version: 2.7.3
Location: /path/to/virtualenv/lib/python2.7/site-packages
Requires: markupsafe

In previous versions, pip freeze and grep should suffice.

$ pip freeze | grep Jinja2
Jinja2==2.7.3

Answered by 2 revs

Solution #2

I recently submitted a pip pull request with the enhancement. Hugo Tavares expressed his thoughts as follows:

(specloud as example)

$ pip show specloud

Package: specloud
Version: 0.4.4
Requires:
nose
figleaf
pinocchio

Answered by Bengineer

Solution #3

A list command has been added to Pip 1.3:

$ pip list
argparse (1.2.1)
pip (1.5.1)
setuptools (2.1)
wsgiref (0.1.2)

Answered by RickyA

Solution #4

You can acquire the Current and Latest versions of the packages you’re using by adding —outdated as an extra argument:

$ pip list --outdated
distribute (Current: 0.6.34 Latest: 0.7.3)
django-bootstrap3 (Current: 1.1.0 Latest: 4.3.0)
Django (Current: 1.5.4 Latest: 1.6.4)
Jinja2 (Current: 2.6 Latest: 2.8)

So, combining AdamKG’s response:

$ pip list --outdated | grep Jinja2
Jinja2 (Current: 2.6 Latest: 2.8)

Also, take a look at pip-tools: https://github.com/nvie/pip-tools

Answered by KevinS

Solution #5

You may also install yolk and then run yolk -l to get some interesting results. Here’s what I get for my small virtual environment:

(venv)CWD> /space/vhosts/pyramid.xcode.com/venv/build/unittest 
project@pyramid 43> yolk -l
Chameleon       - 2.8.2        - active 
Jinja2          - 2.6          - active 
Mako            - 0.7.0        - active 
MarkupSafe      - 0.15         - active 
PasteDeploy     - 1.5.0        - active 
Pygments        - 1.5          - active 
Python          - 2.7.3        - active development (/usr/lib/python2.7/lib-dynload)
SQLAlchemy      - 0.7.6        - active 
WebOb           - 1.2b3        - active 
account         - 0.0          - active development (/space/vhosts/pyramid.xcode.com/project/account)
distribute      - 0.6.19       - active 
egenix-mx-base  - 3.2.3        - active 
ipython         - 0.12         - active 
logilab-astng   - 0.23.1       - active 
logilab-common  - 0.57.1       - active 
nose            - 1.1.2        - active 
pbkdf2          - 1.3          - active 
pip             - 1.0.2        - active 
pyScss          - 1.1.3        - active 
pycrypto        - 2.5          - active 
pylint          - 0.25.1       - active 
pyramid-debugtoolbar - 1.0.1        - active 
pyramid-tm      - 0.4          - active 
pyramid         - 1.3          - active 
repoze.lru      - 0.5          - active 
simplejson      - 2.5.0        - active 
transaction     - 1.2.0        - active 
translationstring - 1.1          - active 
venusian        - 1.0a3        - active 
waitress        - 0.8.1        - active 
wsgiref         - 0.1.2        - active development (/usr/lib/python2.7)
yolk            - 0.4.3        - active 
zope.deprecation - 3.5.1        - active 
zope.interface  - 3.8.0        - active 
zope.sqlalchemy - 0.7          - active 

Answered by Gustavo

Post is based on https://stackoverflow.com/questions/10214827/find-which-version-of-package-is-installed-with-pip