RHEL 6.x - yum gives "ImportError: No module named cElementTree" errors

The fix:

Apparently, the Oracle installation on this system injected Oracle's path into LD_LIBRARY_PATH...

[root@dev1v etc]# export 
declare -x LD_LIBRARY_PATH="/home/oracle/app/oracle/product/11.2.0/client_1/lib"

Unsetting the variable allowed yum to function properly again.


Hmm, in python 2.6, cElementTree lives in /usr/lib64/python2.6/xml/etree/cElementTree.py, which is part of the python package. The fact that you're reaching the import cElementTree in the yum code indicates that xml.etree seems missing.

Try reinstalling python by manually downloading the rpm and using rpm -Uvh.

If that doesn't work, what happens if you import xml.etree.cElementTree in a python shell? What does rpm --verify python say?


I have also seen someone causing this issue by putting Oracle's lib/ path in /etc/ld.so.conf.d

Using:

echo /opt/oracle/app/product/11.2.0/dbhome_1/lib/ > /etc/ld.so.conf.d/oracle.conf

Solved this issue by removing /etc/ld.so.conf.d/oracle.conf.