pip: pip3 list -o fails with TypeError: unorderable types: Version() > SetuptoolsVersion()
In case vendor packages of pip are unbundled but the vendored “packaging” in setuptool (pkg_resources) not, pip3 list -o
fails with
Exception:
Traceback (most recent call last):
File "/usr/lib64/python3.4/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/lib64/python3.4/site-packages/pip/commands/list.py", line 95, in run
self.run_outdated(options)
File "/usr/lib64/python3.4/site-packages/pip/commands/list.py", line 107, in run_outdated
if version > dist.parsed_version:
TypeError: unorderable types: Version() > SetuptoolsVersion()
I cannot find the origin of the problem. packaging is 15.3 as it is in setuptools-18.2 and pip-7.1.2.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 3
- Comments: 32 (6 by maintainers)
Commits related to this issue
- dev-python/pip: Fix blocker Package-Manager: portage-2.2.27 Signed-off-by: Justin Lecher <jlec@gentoo.org> — committed to gentoo/gentoo by jlec 8 years ago
As @Kami-no said, this is caused by the fact that the way some distros package pip is not supported and fragile. The way to fix this to install pip from PyPI. You can even do this to fix it:
I recommend passing
--user
additionally.Workaround for anyone experiencing this:
To forcibly install the “real” version of pip from PiPy.
Final solution:
Suppose smth wrong with pip from distro (Kali Linux + virtualenv)
It’s not about pip version it’s about pip from disto. Force to download pip from pip by downgrading it (even any lesser release). Now the problem is solved (pip3 list -o) and you’re free to upgrade pip or any other package with pip.
That command,
pip3 install --ignore-installed pip --user
, broke pip3 for meI can confirm this is still a problem. I had all the latest versions, but:
But many thanks to @pradyunsg because this:
Fixed it! ❤️
The same happens for me with 9.0.1. Solved with:
You can’t break the system pip by installing another version in your site package. However the pip’s main entrypoint changed in newer versions, and even when you use one of the
/usr/bin/pip
launcher, you’re user installed version will be used (that’s normal, that’s how the Python path work): hence the import error. You can usepython -s -m pip
to invoke the system version even if you have another user installed version (-s
will disable the user site). Finally, you can usepython -m site
to find out the location of user site packages.Linux mint 19 Tara Python 3.6.5 Pip 9.0.1