pypa/pip

pip3.11 check wrongly reports certifi as not installed when using certifi-system-store

mgorny opened this issue · 1 comments

Description

We're using certifi-system-store as a replacement for certifi. This includes creating a symlink for .dist-info:

lrwxrwxrwx 1 root root     40 May  9 17:06 certifi-3021.3.16.dist-info -> certifi_system_store-3021.3.16.dist-info
drwxr-xr-x 1 root root     80 Jun 24 11:22 certifi_system_store-3021.3.16.dist-info

and it using provides in setup.cfg:

provides = certifi
obsoletes = certifi (< 3000.0)

Prior to Python 3.11, pip check didn't complain about it. However, for some reason it does with Python 3.11 (this is with system packages):

$ pip3.11 check
httpcore 0.15.0 requires certifi, which is not installed.
httpx 0.23.0 requires certifi, which is not installed.
sphobjinv 2.2.2 requires certifi, which is not installed.
requests 2.28.0 requires certifi, which is not installed.

FWICS both importlib.metadata and pkg_resources can find the dist-info just fine:

>>> import importlib.metadata
>>> importlib.metadata.distribution("certifi")
<importlib.metadata.PathDistribution object at 0x7f70144fe910>
>>> importlib.metadata.distribution("certifi").name
'certifi-system-store'

>>> import pkg_resources
>>> pkg_resources.get_distribution("certifi")
certifi 3021.3.16 (/usr/lib/python3.11/site-packages)

Expected behavior

No response

pip version

22.1.2

Python version

3.11.0b3

OS

Gentoo Linux

How to Reproduce

Unfortunately, I don't seem to be able to create a reliable reproducer. I think this might have something to do with filesystem or dict iteration order.

Output

No response

Code of Conduct

The Provides metadata field is not used by pip, and basically any other Python packaging tool. See https://packaging.python.org/en/latest/specifications/core-metadata/#rarely-used-fields for more details.