Python – RHEL 6.x – yum gives “ImportError: No module named cElementTree” errors

pythonrhel6yum

I'm making a set of changes to a group of 150 servers. All systems were able to successfully download and install a specific set of RPM's via yum, except for one. One this particular system, all yum commands outside of "clean" dump the following to the screen:

[root@dev1v ~]# yum install sssd
Loaded plugins: rhnplugin
/usr/lib64/python2.6/xmlrpclib.py:612: DeprecationWarning: The xmllib module is obsolete.  Use xml.sax instead.
  import xmllib # lazy subclassing (!)
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 136, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 434, in doCommands
    self._getTs(needTsRemove)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
    self._getTsInfo(remove_only)
  .
  .
  .
  File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 124, in __init__
    self.parse(srcfile)
  File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 140, in parse
    parser = iterparse(infile)
  File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1169, in cElementTree_iterparse
    _cElementTree_import()
  File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
    import cElementTree
ImportError: No module named cElementTree

I've tried:

  • yum clean
  • reinstalling bits and pieces manually via RPM… expat, part of python, etc.
  • rebuilding the RPM database

Any thoughts?

Best Answer

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.

Related Topic