Categories

Thursday 21 November 2013

No module named yum

Hi ,


I got an error as below on running the command on a centos 6.3  server.




There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.3 (default, May 15 2012, 17:45:42)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq




Some one installed installed  a new version of python for running eclypse on the machine and the system python package corrupted due to it, thereby corrupting the yum package.



Below is the steps I have done to fix it.


1)I checked the system location of python which is /usr/bin/python which is version 2.6


/usr/bin/python --version


2) I ran the command "rpm -V python" which will verify all the system packages and will report any error happened to them.


I got error as


Missing /usr/lib64/python2.6.6/*


That is all the system folder for python was some how deleted .




I have to recreate that folder for yum to work


3) I checked one of the identical server where /usr/lib64/python2.6.6 exists and then copied that folder to the other machine where folder is missing.  
The above step saved my time. Otherwise I need to reinstall the python 2.6.6 from centos repository



 cd /usr/lib64
 scp -r python2.6/ root@10.11.16.145:/usr/lib64/

But still I got one error as below


AttributeError: 'YumBaseCli' object has no attribute '_not_found_i'

 It seems that some file system atributes is still having issues. So I had to reinstall the current version of yum

First check the version of yum installed on the machine 

rpm -q yum
yum-3.2.29-40.el6.centos.noarch

Now download the same version of yum "yum-3.2.29-40.el6.centos.noarch"


wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm


Then reinstall it using the command  


rpm -ivh --replacepkgs yum-3.2.29-40.el6.centos.noarch.rpm

 
And now yum worked with out any issues .




Cheers
Syamkumar.M

Ad