How to install and uninstall Python packages using Pip

Installing and managing packages of Python is a pain. Many popular Python packages are available for installation from Ubuntu repositories, but they can very old. Latest packages can be installed from PyPI using easy_install, but it makes it difficult to uninstall or upgrade packages.

I have found that the most convenient way to install and manage Python packages is Pip.

Install

An ancient version of Pip is available in Ubuntu repositories as the package python-pip. This is very old and using it leads to lots of problems down the line. I recommend not using this package.

Pip itself is available as a Python package at PyPI, so it can be installed from there:

$ sudo easy_install pip

Use

  • To install a package named foo from PyPI:
$ sudo pip install foo
  • To uninstall a package named foo:
$ sudo pip uninstall foo
  • To upgrade an installed package named foo:
$ sudo pip install --upgrade foo
  • To list all installed packages and their versions:
$ pip list
  • To search PyPI for a package named foo:
$ pip search foo

Tried with: Pip 7.1.0, Python 2.7.6 and Ubuntu 14.04

Advertisements

3 thoughts on “How to install and uninstall Python packages using Pip”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s