How to fix an AssertionError when trying to list Python packages with the ‘pip list’ command

The Problem

Getting the following assertion error when trying to list the Python packages:

pip list

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/", line 134, in main
    status =, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/", line 80, in run
  File "/usr/lib/python2.7/dist-packages/pip/commands/", line 127, in run_listing
  File "/usr/lib/python2.7/dist-packages/pip/commands/", line 136, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/lib/python2.7/dist-packages/pip/", line 347, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/lib/python2.7/dist-packages/pip/", line 194, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='

means that either pip is outdated on the host machine or the distribute package.

The Solution

Upgrading pip

pip can be upgraded using the following set of commands:

# download via curl
curl -O
# download via wget

# installing pip
sudo python


pip install -U pip

More information about pip installation and upgrade can be found here.

Upgrading the distribute package

pip install --upgrade distribute