"pip3 list --outdated" raises TypeError

Bug #1579181 reported by Paul Natsuo Kishimoto on 2016-05-06
This bug affects 10 people
Affects Status Importance Assigned to Milestone
python-pip (Debian)
python-pip (Ubuntu)

Bug Description


$ pip3 list --outdated
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 118, in run
  File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 128, in run_outdated
    if latest_version > dist.parsed_version:
TypeError: unorderable types: Version() > SetuptoolsVersion()

Expected: a list of outdated packages is displayed.

This particular exception appears to be discussed upstream at:

where an upstream dev says, quote, "I don't think there's anything we can reasonably do here, you're running a patched or unsupported version of pip. You should file a bug with whomever gave you your copy of pip and ask them to stop patching it."

$ lsb_release -rd && apt-cache policy python3-pip
Description: Ubuntu 16.04 LTS
Release: 16.04
  Installed: 8.1.1-2
  Candidate: 8.1.1-2
  Version table:
 *** 8.1.1-2 500
        500 http://mirrors.mit.edu/ubuntu xenial/universe amd64 Packages
        500 http://mirrors.mit.edu/ubuntu xenial/universe i386 Packages
        100 /var/lib/dpkg/status

Paul Natsuo Kishimoto (khaeru) wrote :

A workaround is:

$ pip3 install --user --no-deps pip
Collecting pip
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 612kB/s
Installing collected packages: pip
Successfully installed pip-8.1.1

…(i.e. exactly the same version of pip) and ensure ~/.local/bin is in my $PATH.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-pip (Ubuntu):
status: New → Confirmed
Edwin Khoo (edwinksl) wrote :

If you are using virtualenv, then forcing a reinstallation of pip is a workaround:

pip install -U --force-reinstall pip

tags: added: artful
Changed in python-pip (Debian):
status: Unknown → New

The affected package should be python3-pip and not python-pip, since 'pip list --outdated' doesn't provoke the exception, but 'pip3 list --outdated' does.

Kent Ross (mumbleskates) wrote :

This is occurring for me with python3.6-dev==3.6.4-4 amd64 from bionic/main. Forcing a reinstall of the system's python3.6 pip package fixes it, but this is pretty lousy default behavior.

Kent Ross (mumbleskates) wrote :

I suppose I should clarify: the system pip package is python3-pip==9.0.1-2 amd64 from bionic/universe

Ömer Fadıl USTA (omerusta) wrote :

With latest pip this issue solved. On the other hand you have to patch makepip3.py file (which creates /usr/bin/pip3 )

Ömer Fadıl USTA (omerusta) wrote :

I mean that patch for python3-pip package packagers . If you upgrade pip with pip (with sudo ) you need to edit your /usr/bin/pip3 file with this :


import sys

# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip._internal import main as _main
if __name__ == '__main__':

The attachment "patch for after updating pip via pip with sudo" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch

The problem still exists in Ubuntu 19.04/disco with a slightly different error message:

$ pip3 list --outdated
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 138, in run
    packages = self.get_outdated(packages, options)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 149, in get_outdated
    dist for dist in self.iter_packages_latest_infos(packages, options)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 150, in <listcomp>
    if dist.latest_version > dist.parsed_version
TypeError: '>' not supported between instances of 'Version' and 'Version'

tags: added: disco
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.