18

I'm trying to install the win32core module using pip, but it keeps displaying warnings about the package/wheel metadata not matching with the filename (inconsistent version).

Here's a snippet of the text displayed in the command prompt before it goes to download older versions:

python -m pip install --no-cache-dir win32core
Collecting win32core
  Downloading win32core-221.28.tar.gz (2.1 MB)
     |████████████████████████████████| 2.1 MB 2.2 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
WARNING: Discarding https://files.pythonhosted.org/packages/24/
0a6e0b2e201c76ccd3cda1f97bd64d45daa2b899b50e541962748ec5bc9f5d/
win32core-221.28.tar.gz#
sha256=e805548ccde99a3f36931d3eef72cfaaa5dace4288393af898c96f92c1fe5f9e (from https://pypi.org/simple/win32core/).
Requested win32core from https://files.pythonhosted.org/packages/
24/0a/6e0b2e201c76ccd3cda1f97bd64d45daa2b899b50e541962748ec5bc9f5d/win32core-221.28.tar.gz#
sha256=e805548ccde99a3f36931d3eef72cfaaa5dace4288393af898c96f92c1fe5f9e
has inconsistent version: filename has '221.28', but metadata has '0.0.0'

As I've encountered this before, how should I go about installing the module correctly? (I'm on Python 3.9.1)

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
na-no.
  • 344
  • 1
  • 3
  • 11
  • 1
    This problem happened on my device as well, so it must be on the server side (www.pythonhosted.com) – A random coder Apr 13 '21 at 12:22
  • @Arandomcoder not really, something is broken in `setuptools` or `pip`... I'm running now: `pip install -U pip` and getting: `(...) has inconsistent version: filename has '22.1.2', but metadata has '22.1.2'` and `pip` goes into a download loop trying older and older versions... Dependencies are NP-complete... Ther scr***d up! I want the old "dumb" `pip` back! – Tomasz Gandor Jun 07 '22 at 11:17

2 Answers2

28

Pip changed rules in the version resolver, it is more strict now.

See discussions :

https://github.com/pypa/pip/issues/9186

https://github.com/pypa/pip/issues/9203

Try using :

python -m pip install --upgrade --no-cache-dir --use-deprecated=legacy-resolver <your_package>
Kochise
  • 504
  • 5
  • 10
  • 2
    Using --use-deprecated=legacy-resolver will just crash pip: File "/usr/lib/python3.10/site-packages/packaging/version.py", line 264, in __init__ match = self._regex.search(version) TypeError: expected string or bytes-like object" – Ruben Kelevra Apr 12 '22 at 18:42
  • 1
    @RubenKelevra Thank for the info, but 3.10 has seen several changes as well. Anyway, packages should be maintained or backward compatibility should be ensured. – Kochise May 31 '22 at 07:22
  • 1
    It was specifically the `--use-deprecated=legacy-resolver` option that solved this problem for me (for a different package with the same metadata error). – Mead Jan 10 '23 at 11:22
  • 2
    I still get the warning when I run this command itself!. `WARNING: Skipping /opt/homebrew/lib/python3.11/site-packages/pycparser-2.21-py3.11.egg-info due to invalid metadata entry 'name'` – Dr.jacky Jun 04 '23 at 08:23
1

Encountered this problem with Anaconda Powershell. Downloaded the package and provided pip with the exact path.

(Look Installing modules to Anaconda from .tar.gz)

alshestt
  • 11
  • 1