Process inspecting actor in actors/getenabledmodules failed with -11 error when upgrading from Centos7 to Almalinux 9

Hi I’m following the instructions to upgrade from CentOS 7 to AlmaLinux 9. When running preupgrade as root, I ran into this error

leapp.repository.system_upgrade_common: Process inspecting actor in actors/getenabledmodules failed with -11

And looking at the debug logs, I see that

leapp.fallback: repofileutils.py: failed to import dnf

Is repeated over and over again.

Checking dnf --version gives me

dnf --version
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python2.7/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 29, in <module>
    import libdnf.transaction
  File "/usr/lib64/python2.7/site-packages/libdnf/__init__.py", line 3, in <module>
    from . import conf
  File "/usr/lib64/python2.7/site-packages/libdnf/conf.py", line 17, in <module>
    _conf = swig_import_helper()
  File "/usr/lib64/python2.7/site-packages/libdnf/conf.py", line 16, in swig_import_helper
    return importlib.import_module('_conf')
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _conf

I tried to uninstall and reinstall dnf but still the same error.

Any help would be much appreciated. Thank you!