[Bug 2003583] [NEW] Versions of the form "0.23ubuntu1" do not obey PEP440 and break current pip/setuptools

Adam Novak 2003583 at bugs.launchpad.net
Fri Jan 20 21:18:00 UTC 2023


Public bug reported:

With setuptools 66, the versions of all packages visible in the Python
environment *must* obey PEP440 <https://peps.python.org/pep-0440/>.
Otherwise, attempts to use pip to install a package with a setup.py-
based build system, or other attempts to use the `pkg-resources` module,
can produce errors like this:

  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 844, in _resolve_dist
    env = Environment(self.entries)
  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1044, in __init__
    self.scan(search_path)
  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1077, in scan
    self.add(dist)
  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1096, in add
    dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2631, in hashcmp
    self.parsed_version,
  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2678, in parsed_version
    self._parsed_version = parse_version(self.version)
  File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py", line 266, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '0.23ubuntu1'

The official opinion of the setuptools maintainers seems to be that
version strings of this form haven't *really* been allowed since about
2014, and distributions need to change their package version naming
scheme for Python packages they install, so that the resulting version
strings obey PEP440. See for example
<https://github.com/pypa/setuptools/issues/3772#issuecomment-1384342813>.

Therefore, the version of the `distro-info` package shipped in Focal
cannot remain '0.23ubuntu1', at least as exposed to the Python
environment in `python3-distro-info`. A new version needs to be released
where the version string that Python code sees follows
https://peps.python.org/pep-0440/#public-version-identifiers or
https://peps.python.org/pep-0440/#local-version-identifiers

Other versions of `distro-info` as shipped in other reasonably current
Ubuntu versions would also need to be changed:

1.1build1 in Jammy
1.1ubuntu1 in Kinetic

Older Ubuntu releases that are still "supported" might also need
changes.

** Affects: distro-info (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: reportbug (Ubuntu)
     Importance: Undecided
         Status: New

** Also affects: reportbug (Ubuntu)
   Importance: Undecided
       Status: New

** Bug watch added: github.com/pypa/setuptools/issues #3772
   https://github.com/pypa/setuptools/issues/3772

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to distro-info in Ubuntu.
https://bugs.launchpad.net/bugs/2003583

Title:
  Versions of the form "0.23ubuntu1" do not obey PEP440 and break
  current pip/setuptools

Status in distro-info package in Ubuntu:
  New
Status in reportbug package in Ubuntu:
  New

Bug description:
  With setuptools 66, the versions of all packages visible in the Python
  environment *must* obey PEP440 <https://peps.python.org/pep-0440/>.
  Otherwise, attempts to use pip to install a package with a setup.py-
  based build system, or other attempts to use the `pkg-resources`
  module, can produce errors like this:

    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 844, in _resolve_dist
      env = Environment(self.entries)
    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1044, in __init__
      self.scan(search_path)
    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1077, in scan
      self.add(dist)
    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1096, in add
      dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2631, in hashcmp
      self.parsed_version,
    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2678, in parsed_version
      self._parsed_version = parse_version(self.version)
    File "/builds/databiosphere/toil/venv/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py", line 266, in __init__
      raise InvalidVersion(f"Invalid version: '{version}'")
  pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '0.23ubuntu1'

  The official opinion of the setuptools maintainers seems to be that
  version strings of this form haven't *really* been allowed since about
  2014, and distributions need to change their package version naming
  scheme for Python packages they install, so that the resulting version
  strings obey PEP440. See for example
  <https://github.com/pypa/setuptools/issues/3772#issuecomment-1384342813>.

  Therefore, the version of the `distro-info` package shipped in Focal
  cannot remain '0.23ubuntu1', at least as exposed to the Python
  environment in `python3-distro-info`. A new version needs to be
  released where the version string that Python code sees follows
  https://peps.python.org/pep-0440/#public-version-identifiers or
  https://peps.python.org/pep-0440/#local-version-identifiers

  Other versions of `distro-info` as shipped in other reasonably current
  Ubuntu versions would also need to be changed:

  1.1build1 in Jammy
  1.1ubuntu1 in Kinetic

  Older Ubuntu releases that are still "supported" might also need
  changes.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/distro-info/+bug/2003583/+subscriptions




More information about the foundations-bugs mailing list