On Tue, 30 Oct 2018 21:50:36 +0100 Ben Wiederhake 
<benwiederhake.git...@gmx.de> wrote:
> Package: python3-pip
> Version: 9.0.1-2.3
> Severity: normal
> File: /usr/bin/pip3
> 
> Dear Maintainer,
> 
> I'm having trouble running this command:
> 
>     pip3 list --outdated
> 
> Expected behavior: A list of outdated, local packages
> Actual behavior: TypeError
> 
> Full error message:
> 
>     Traceback (most recent call last):
>       File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in
> main
>         status = self.run(options, args)
>       File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 157, 
in
> run
>         packages = self.get_outdated(packages, options)
>       File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 168, 
in
> get_outdated
>         dist for dist in self.iter_packages_latest_infos(packages, options)
>       File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 169, 
in
> <listcomp>
>         if dist.latest_version > dist.parsed_version
>     TypeError: '>' not supported between instances of 'Version' and 
'Version'
> 
> This is not Debian #878082.
> 
> Arch had a similar problem, there it was a packaging error:
> 
> https://github.com/pypa/pip/issues/5429
> 
> Could it be that the Debian package has a similar issue?

The problem turns out to be that setuptools and pip have different approaches 
for managing the namespace for packages they vendor and they are incompatible.  
Thanks to the incomparable dstufft for figuring it out.  The attached patch 
works around this incompatibility.  I've tested it with pip 20.2 on unstable 
and it resolves the issue.  This or something similar should work on earlier 
versions too.

Scott K
--- a/src/pip/_internal/commands/list.py	2019-12-09 04:01:21.000000000 +0000
+++ b/src/pip/_internal/commands/list.py	2020-04-01 03:10:23.480796645 +0000
@@ -22,6 +22,8 @@
 )
 from pip._internal.utils.packaging import get_installer
 
+from pip._vendor.packaging.version import parse
+
 logger = logging.getLogger(__name__)
 
 
@@ -164,13 +166,13 @@
     def get_outdated(self, packages, options):
         return [
             dist for dist in self.iter_packages_latest_infos(packages, options)
-            if dist.latest_version > dist.parsed_version
+            if parse(str(dist.latest_version)) > parse(str(dist.parsed_version))
         ]
 
     def get_uptodate(self, packages, options):
         return [
             dist for dist in self.iter_packages_latest_infos(packages, options)
-            if dist.latest_version == dist.parsed_version
+            if parse(str(dist.latest_version)) == parse(str(dist.parsed_version))
         ]
 
     def get_not_required(self, packages, options):

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to