yumupgrades for production use, this is the repository for you.
Active subscription is required.
Operating System and Software
- Rocky Linux 8
- Python 2.7
- Python 3.6
- python2/python3 scripts fail to import the python module
- When I run my python script that is copied over from CentOS 7 or before, the following is seen:
Traceback (most recent call last): <snip> ImportError: No module named yum
How to Fix
Migrate any scripts making use of the Legacy YUM v3 API to the newer YUM v4 API.
Origin of the Problem
Disclaimer: We are not responsible for the content of external links.
With the migration to Rocky Linux 8, the Legacy YUM v3 APIs are no longer available. This is documented in the following:
From the above, the following is applicable:
Note that the legacy Python API provided by YUM v3 is no longer available. Users are advised to migrate their plug-ins and scripts to the new API provided by YUM v4 (DNF Python API), which is stable and fully supported. The DNF Python API is available at DNF API Reference.
1) Verify the version of Rocky Linux 8
$ cat /etc/redhat-release Rocky Linux release 8.0 (Ootpa)
2) Verify that the module is not loadable:
$ python3 -c "import yum" Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'yum'