Skip to content

[BUG] setuptools on Python 3.8 does not normalize wheel names #5051

@stephenfin

Description

@stephenfin

setuptools version

setuptools==75.3.2

Python version

Python 3.8

OS

Fedora (though n/a tbh)

Additional environment information

No response

Description

Short version

setuptools v75.8.2 addressed an issue with wheel normalization (I think via #4853). Would it be possible to backport this and cut a final v75.3.3 release? I tried to propose a PR, but the v75.3.2 tag and the maint/75.3 branch it's on does not appear to match the 75.3.2 release on PyPI (the version and python-requires in pyproject.toml file is wrong and the git history looks off).

Long version

OpenStack recently started normalizing wheel names (yes, as it should have been doing all along). For example, oslo.messaging 14.9.1 uses periods in wheels, while oslo.messaging 14.9.2 uses underscores. Unfortunately this exposes a bug in the latest version of pkg_resources to support Python 3.8. We don't support this (upstream) EOL Python version for in recent releases but the stable/2024.1 release is still maintained for a few more months and that supports Python 3.8.

Expected behavior

pkg_resources.require should handle the differences between wheel file names and package names.

How to Reproduce

❯ virtualenv --python=python3.8 .venv
❯ source .venv/bin/activate
❯ pip install --upgrade setuptools
❯ pip install oslo.middleware
❯ python -c 'import pkg_resources; pkg_resources.require("oslo.middleware")'
❯ ls -la venv-py38/lib/python3.8/site-packages/ | grep oslo

Output

<string>:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv-py38/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1070, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/tmp/venv-py38/lib/python3.8/site-packages/pkg_resources/__init__.py", line 897, in resolve
    dist = self._resolve_dist(
  File "/tmp/venv-py38/lib/python3.8/site-packages/pkg_resources/__init__.py", line 938, in _resolve_dist
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'oslo.utils>=3.33.0' distribution was not found and is required by oslo.middleware
drwxr-xr-x.  5 stephenfin stephenfin  340 Jul 17 15:10 oslo_config
drwxr-xr-x.  2 stephenfin stephenfin  220 Jul 17 15:10 oslo.config-9.6.0.dist-info
drwxr-xr-x.  4 stephenfin stephenfin  160 Jul 17 15:10 oslo_context
drwxr-xr-x.  2 stephenfin stephenfin  200 Jul 17 15:10 oslo.context-5.6.0.dist-info
drwxr-xr-x.  5 stephenfin stephenfin  300 Jul 17 15:10 oslo_i18n
drwxr-xr-x.  2 stephenfin stephenfin  200 Jul 17 15:10 oslo.i18n-6.4.0.dist-info
drwxr-xr-x.  6 stephenfin stephenfin  420 Jul 17 15:10 oslo_middleware
drwxr-xr-x.  2 stephenfin stephenfin  240 Jul 17 15:10 oslo.middleware-6.2.0.dist-info
drwxr-xr-x.  6 stephenfin stephenfin  480 Jul 17 15:10 oslo_utils
drwxr-xr-x.  2 stephenfin stephenfin  200 Jul 17 15:10 oslo_utils-7.3.1.dist-info

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions