Leapp preupgrade throws idna version mismatch exception

I wanted to upgrade Almalinux 8.8 to 9, however when running preupgrade this happens.
what to do?

[martin@hex ~]$ sudo leapp preupgrade
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 779, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (idna 3.3 (/usr/lib/python3.6/site-packages), Requirement.parse('idna<2.8,>=2.5'), {'requests'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/leapp", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 572, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 585, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'idna<2.8,>=2.5' distribution was not found and is required by requests
[martin@hex ~]$ sudo leapp preupgrade
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 779, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (idna 3.3 (/usr/lib/python3.6/site-packages), Requirement.parse('idna<2.8,>=2.5'), {'requests'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/leapp", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 572, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 585, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'idna<2.8,>=2.5' distribution was not found and is required by requests

Alma 8 has idna version 2.5 and Alma 9 has 2.10:

[al8]# rpm -qf /usr/lib/python3.6/site-packages/idna*
python3-idna-2.5-5.el8.noarch
python3-idna-2.5-5.el8.noarch
[el9]# rpm -qf /usr/lib/python3.9/site-packages/idna*
python3-idna-2.10-7.el9.noarch
python3-idna-2.10-7.el9.noarch

Why does the script say “idna 3.3” in your system?

I seems I added a repository, that somehow porovides a higher version of the package.

[martin@hex ~]$ dnf list installed "python3-idna"
Installed Packages
python3-idna.noarch                                             3.3-1.el8                                             @forensics

Now the question is: how do I safely replace the 3.3 version with 2.5 version?

One could try:

dnf downgrade python3-idna-2.5-5.el8

In that DNF attempts to install that specific version (and remove current 3.3).
That might require (temporary) removal of other packages that require the 3.3.


Overall, everything “non-default” has always been a challenge with leapp (as long as Red Hat has had that tool for RHEL). If one can remove everything third-party, then chances of successful conversion do improve.


Personally, I prefer fresh install, deployment of appropriate config, and transfer/restore of user data. (“Prefer” as in “the one time I did consider migration, I chose to go fresh instead, just like in all other systems”.)

Thank you, that worked well.

Doing a fresh install might be a better idea, than removing “non-default” packages from the old system, mangling it beyond recognition. I have a spare small ssd disk, this way I can do a fresh install of Alma 9 on the side while being able to drop back to still functional Alma 8 when needed. And when I am happy with my new install I can clone it to the main SSD. This sounds as a much better and actually safer idea.
thank you for your help :grin: