0

when I am using YUM package in python 2.7.5 on RHEL 7 the things are working fine,

but now we are switching to new Redhat 8 which is having python 2.7.18

and we saw that yum and rpm packages are not installed in spite we installed the following rpm's on RedHat 8

yum-4.7.0-16.el8_8.noarch
python-rpm-macros-3-41.el8.noarch

just to see the differences between Redhat 7 to RedHat 8

on RedHat 7 , we have the following folders

/usr/lib/python2.7/site-packages/yum
/usr/lib64/python2.7/site-packages/rpm

python --version
Python 2.7.5

on RedHat 8 , we not have the folders yum and rpm

ls /usr/lib/python2.7/site-packages/ | grep yum   ( no output ) 
ls /usr/lib64/python2.7/site-packages/ | grep rpm ( no output ) 

python --version
Python 2.7.18

regarding to RedHat 7 , we also verified which rpm's installed in order to create the folders yum and rpm , here example from what we see

rpm -qf /usr/lib/python2.7/site-packages/yum/yumRepo.py
yum-3.4.3-168.el7.noarch

rpm -q --whatprovides  /usr/lib64/python2.7/site-packages/rpm/__init__.py
rpm-python-4.11.3-48.el7_9.x86_64

so we not understand what we are misisng here on RedHat 8

why packages as yum and rpm are not installed ?

example:

python2 -c "import yum"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named yum


python2 -c "import rpm"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named rpm
Judy
  • 1,595
  • 6
  • 19
  • 41

1 Answers1

0

This is because in RHEL 8 is the Python 3 the default Python implementation. See https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/rhel-8_0_0_release#web-servers-databases-dynamic-languages

And all default system tools and applications use python3. There is a package python2 that includes Python 2 to ease customers' transition period.

Additionally YUM has been replaced by DNF. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/rhel-8_0_0_release#software-management

So you need to migrate from python-yum to python3-dnf. RPM bindings are in package python3-rpm

but now we are switching to new Redhat 8

Do you know that RHEL 8 is not new? Yes, it is newer than RHEL7. But you save a lot of time when you migrate to RHEL 9. RHEL 9 is already one year old.

msuchy
  • 5,162
  • 1
  • 14
  • 26