Invalid version: '0.23ubuntu1' causes subsequent pip3 install failures

Bug #2008121 reported by Henry Ward Hopeman Jr.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
distro-info (Ubuntu)
Fix Released
High
Unassigned

Bug Description

During installation of pip3/python modules we run into an "Invalid version" error that lists this package as the source.

---------
Docker container of Ubuntu 20.04
Description: Ubuntu 20.04.5 LTS
Release: 20.04

#apt-cache policy python3-distro-info
python3-distro-info:
  Installed: 0.23ubuntu1
  Candidate: 0.23ubuntu1
  Version table:
 *** 0.23ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

---------
# apt show python3-distro-info
Package: python3-distro-info
Version: 0.23ubuntu1
Priority: standard
Section: python
Source: distro-info
Origin: Ubuntu
Maintainer: Ubuntu Developers <email address hidden>
Original-Maintainer: Benjamin Drung <email address hidden>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 32.8 kB
Depends: distro-info-data, python3:any
Task: standard
Download-Size: 5924 B
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: information about distributions' releases (Python 3 module)

-------
We expected to be able to install a pip3 package - in this case pre-commit.

Command and subsequent error:
# pip3 install pre-commit
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 270, in _get_abstract_dist_for
    skip_reason = self._check_skip_installed(req)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 228, in _check_skip_installed
    req_to_install.check_if_exists(self.use_user_site)
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 443, in check_if_exists
    self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 514, in get_distribution
    dist = get_provider(dist)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 386, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 956, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 815, in resolve
    dist = self._resolve_dist(
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 844, in _resolve_dist
    env = Environment(self.entries)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1044, in __init__
    self.scan(search_path)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1077, in scan
    self.add(dist)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1096, in add
    dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2640, in hashcmp
    self.parsed_version,
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 2694, in parsed_version
    raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '0.23ubuntu1' (package: distro-info)

--------------
steps to reproduce:
- clean ubuntu install
- install curl gnupg lsb-release python3 python3-pip lsb-release wget software-properties-common libomp5-12
- pip3 install --upgrade setuptools (necessary for other packages we use)
- pip3 install pre-commit

Revision history for this message
Stefano Rivera (stefanor) wrote (last edit ):

This is a duplicate of LP: #1991606 (but the LP machinery won't let me set that right now, it's timing out)

Revision history for this message
Henry Ward Hopeman Jr. (neahwhopeman) wrote (last edit ):

@stefanor Agreed. I will also try to mark it as duplicate, though I am getting the timeouts as well.

Revision history for this message
Henry Ward Hopeman Jr. (neahwhopeman) wrote :

Feel free to close. I am still unable to mark as duplicate.

Revision history for this message
Benjamin Drung (bdrung) wrote :

This bug is a duplicate of bug #1991606 but due to bug #2008514 it runs into a timeout when marking as duplicate. Since distro-info in Ubuntu 23.04 (lunar) is fixed, I am marking this bug is fixed as well. Please follow bug #1991606 for the updates to the stable releases.

Changed in distro-info (Ubuntu):
status: New → Fix Released
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.