Yum Command Error With ''ImportError: No module named rpm'

(Doc ID 2352078.1)

Last updated on JANUARY 30, 2018

Applies to:

Linux OS - Version Oracle Linux 5.11 and later
Linux x86-64

Symptoms

yum command error -  import rpm ImportError: No module named rpm.

# yum repolist

Traceback (most recent call last):
File "/usr/bin/yum", line 22, in
import yummain
File "/usr/share/yum/yummain.py", line 22, in
import clientStuff
File "/usr/share/yum/clientStuff.py", line 18, in
import rpm
ImportError: No module named rpm

# ldd /usr/bin/python

linux-vdso.so.1 => (0x00007fff9fdfd000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000310f800000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000310f000000)
libutil.so.1 => /lib64/libutil.so.1 (0x000000311f200000)
libm.so.6 => /lib64/libm.so.6 (0x000000310f400000)
libc.so.6 => /lib64/libc.so.6 (0x000000310ec00000)
/lib64/ld-linux-x86-64.so.2 (0x000000310e800000)

# which python
/usr/local/bin/python

# python -V
Python 2.7.10

 

Changes

Updated few packages including  rpm-python-4.4.2.3-36.0.1.el5_11.x86_64.rpm, as part of OS / Kernel updates.

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms