Leapp upgrade from Alma 8 to 9 fails with AttributeError: module 'leapp.cli' has no attribute 'main'

I’m following this guide:

ELevating CentOS 7 to AlmaLinux 9 | AlmaLinux Wiki

After “leapp upgrade” and “reboot” it almost reaches the end and then fails with the following error after which it exists into Emergency mode shell. This happens during the last (ramfs boot) phase when it is finishing the upgrade.

If I simply reboot the system after this error - it boots into the new AlmaLinux 9.4 - as if upgrade is competed successfully.

The problem is: because it fails and stuck in the emergency shell - I can’t make the upgrade procedure automatic and run it remotely on multiple servers. I will need to have physical access to each of them to reboot them when they stuck in the emergency mode:

....
May 06 14:20:55 localhost upgrade[1714]:   python3-slip-dbus-0.6.4-13.el8.noarch
May 06 14:20:55 localhost upgrade[1714]:   trousers-0.3.15-1.el8.x86_64
May 06 14:20:55 localhost upgrade[1714]:   trousers-lib-0.3.15-1.el8.x86_64
May 06 14:20:55 localhost upgrade[1714]: Complete!
May 06 14:20:58 localhost upgrade[847]: ====> * prepare_python_workround
May 06 14:20:58 localhost upgrade[847]:         Prepare environment to be able to run leapp with Python3 in initrd.
May 06 14:20:58 localhost upgrade[847]: ====> * scan_installed_target_kernel_version
May 06 14:20:58 localhost upgrade[847]:         Scan for the version of the newly installed kernel
May 06 14:20:58 localhost upgrade[847]: ====> * update_grub_core
May 06 14:20:58 localhost upgrade[847]:         On legacy (BIOS) systems, GRUB core (located in the gap between the MBR and the
May 06 14:20:58 localhost upgrade[847]: ====> * pythonthreetmpworkaround
May 06 14:20:58 localhost upgrade[847]:         Create the /usr/bin/python3 alternative if not exists.
May 06 14:20:59 localhost upgrade[847]: Debug output written to /var/log/leapp/leapp-upgrade.log
May 06 14:20:59 localhost upgrade[847]: ============================================================
May 06 14:20:59 localhost upgrade[847]:                            REPORT
May 06 14:20:59 localhost upgrade[847]: ============================================================
May 06 14:20:59 localhost upgrade[847]: A report has been generated at /var/log/leapp/leapp-report.json
May 06 14:20:59 localhost upgrade[847]: A report has been generated at /var/log/leapp/leapp-report.txt
May 06 14:20:59 localhost upgrade[847]: ============================================================
May 06 14:20:59 localhost upgrade[847]:                        END OF REPORT
May 06 14:20:59 localhost upgrade[847]: ============================================================
May 06 14:20:59 localhost upgrade[847]: Answerfile has been generated at /var/log/leapp/answerfile
May 06 14:20:59 localhost kernel: XFS (dm-2): Unmounting Filesystem 1ea9ceb6-5f7f-4ae9-88a4-aa1755d7d9ed
May 06 14:20:59 localhost kernel: XFS (sda2): Unmounting Filesystem 6fe338dc-fd17-4d57-a9fb-b715eb841f24
May 06 14:20:59 localhost kernel: XFS (sda2): Mounting V5 Filesystem 6fe338dc-fd17-4d57-a9fb-b715eb841f24
May 06 14:20:59 localhost kernel: XFS (sda2): Ending clean mount
May 06 14:20:59 localhost kernel: xfs filesystem being mounted at /boot supports timestamps until 2038 (0x7fffffff)
May 06 14:20:59 localhost kernel: FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
May 06 14:20:59 localhost kernel: XFS (dm-2): Mounting V5 Filesystem 1ea9ceb6-5f7f-4ae9-88a4-aa1755d7d9ed
May 06 14:20:59 localhost kernel: XFS (dm-2): Ending clean mount
May 06 14:20:59 localhost kernel: xfs filesystem being mounted at /home supports timestamps until 2038 (0x7fffffff)
**May 06 14:20:59 localhost upgrade[58153]: Traceback (most recent call last):**
**May 06 14:20:59 localhost upgrade[58153]:   File "/root/tmp_leapp_py3/leapp3", line 6, in <module>**
**May 06 14:20:59 localhost kernel: XFS (dm-2): Unmounting Filesystem 1ea9ceb6-5f7f-4ae9-88a4-aa1755d7d9ed**
**May 06 14:20:59 localhost upgrade[58153]:     sys.exit(leapp.cli.main())**
**May 06 14:20:59 localhost upgrade[58153]: AttributeError: module 'leapp.cli' has no attribute 'main'**
May 06 14:20:59 localhost kernel: XFS (sda2): Unmounting Filesystem 6fe338dc-fd17-4d57-a9fb-b715eb841f24
May 06 14:20:59 localhost upgrade[775]: writing logs to disk and rebooting