2

I recently upgraded all python data analysis tools using pip. When I do

dpkg -l |grep python

I see the old version numbers of the software I just upgraded via pip.

How can I ensure that the dpkg list reports the correct versions? (I assume dpkg -l needs to be correct)

For example, I upgraded ipython to version 1.0.0 using pip; however, dpkg reports version 0.13.2-1~ubuntu12.04.1

5

It is not the same if you use dpkg instead of pip. The first is a package manager for Debian based systems and provides means to handle packages and install packages from the repositories made by package teams. PIP handles Python only packages and installs them from the cheese shop PyPI.

The two methods differ to the versions which they install with PIP always installing the newest package version.

One method to list all installed packages is to install and use yolk: sudo pip install yolk and then issue yolk -l to list all packages.

Other methods are mentioned at the following SE question:

Also these two questions talk about the difference of apt-get - pip for installing Python packages:

  • I realize now that I should have created a virtualenv for my pip upgrades instead of upgrading the main python installation. Then I would not have to worry about dependency issues due to unknown versions in the main python install on my system. – Antonios Hadjigeorgalis Aug 25 '13 at 21:55
  • While virtualenv and similar tools are not mandatory, it is a good practice to keep your system's Python in good condition. – Stef K Aug 25 '13 at 21:59
2

You're looking at two different package managers. DPKG/APT installs in /usr/lib/python2.7/dist-packages/ (note dist - it comes with the distribution) and pip/easy_install installs in other Python paths.

Both package managers are independent. Your Python application will use the version of the package first in the Python Path. Check your Python path with:

import sys
print sys.path

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.