I recently have an issue trying to install anything with pip. It keeps trying older versions complaining that each one has a version mismatch, when it matches perfectly fine. This following log is from trying to upgrade pip.

~$ pip3 install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/lib/python3.10/site-packages (21.0)
Collecting pip
  Using cached pip-22.0.4-py3-none-any.whl (2.1 MB)
WARNING: Discarding https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl#sha256=c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b (from https://pypi.org/simple/pip/) (requires-python:>=3.7). Requested pip from https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/pip-22.0.4-py3-none-any.whl#sha256=c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b has inconsistent version: filename has '22.0.4', but metadata has '22.0.4'
  Using cached pip-22.0.4.tar.gz (2.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
WARNING: Discarding https://files.pythonhosted.org/packages/33/c9/e2164122d365d8f823213a53970fa3005eb16218edcfc56ca24cb6deba2b/pip-22.0.4.tar.gz#sha256=b3a9de2c6ef801e9247d1527a4b16f92f2cc141cd1489f3fffaf6a9e96729764 (from https://pypi.org/simple/pip/) (requires-python:>=3.7). Requested pip from https://files.pythonhosted.org/packages/33/c9/e2164122d365d8f823213a53970fa3005eb16218edcfc56ca24cb6deba2b/pip-22.0.4.tar.gz#sha256=b3a9de2c6ef801e9247d1527a4b16f92f2cc141cd1489f3fffaf6a9e96729764 has inconsistent version: filename has '22.0.4', but metadata has '22.0.4'
  Using cached pip-22.0.3-py3-none-any.whl (2.1 MB)
WARNING: Discarding https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl#sha256=c146f331f0805c77017c6bb9740cec4a49a0d4582d0c3cc8244b057f83eca359 (from https://pypi.org/simple/pip/) (requires-python:>=3.7). Requested pip from https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl#sha256=c146f331f0805c77017c6bb9740cec4a49a0d4582d0c3cc8244b057f83eca359 has inconsistent version: filename has '22.0.3', but metadata has '22.0.3'

It continues on like this, but the versions of the package and metadata match perfectly fine. Reinstalling python-pip through pacman also did not help.

EDIT: I was able to fix the issue by upgrading Pip as sudo (which enabled it to install system-wide)

  • Any idea what caused this issue? I have the same problem, and it happens even if I run the pip update as root.
    – Dinistro
    Apr 4, 2022 at 20:14
  • No idea, frankly, but I feel that it was a catch 22 scenario. A problem in Pip at the user level (not sure how it was caused, but I think it was my fault as i was messing around with packages) stopped it being installed properly. And installing system-wide might have allowed a proper installation of the upgraded pip. I think you might benefit from uninstalling everything python/pip related, rebooting, and trying again. It's worth it to avoid the hassle in fixing it, trust me. When debugging like this goes from minutes to hours, productivity and time is lost. Or maybe I'm just impatient ;)
    – QuickishFM
    Apr 4, 2022 at 22:10
  • @Dinistro Furthermore I think the problem in your distroy might actually be system-wide instead of at the user level. So there's pretty much no choice but to remove everything and re-install. I'm also looking into using conda so I don't mess up package compatibility with different applications that require certain package versions. Definitely worth it to not have to run into it again. (as well as, of course, full system backups, though I try to fix it since it's quicker than finding and then restoring all of those related files from backup)
    – QuickishFM
    Apr 4, 2022 at 22:13
  • 1
    Yeah, I was messing around with globally installed packages (C++ python bindings). I was in the end forced to reinstall pip and that resolved the issue. Thanks for your response.
    – Dinistro
    Apr 5, 2022 at 12:11


You must log in to answer this question.

Browse other questions tagged .