Saturday, February 13, 2010

No module named yum

I usually do not document installation problems even though I run into them every so often. This one though has taken so much time to get resolved that I decided to document.

So here is the operation system:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
 And here is the problem:
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:
 Of course yum is clearly corrupted and needs to be reinstalled, so as root we will download the corresponding rpm and install it. Note that use the magnificent CentOS rpms.:
mkdir /tmp/yum
cd /tmp/yum
rpm -Uvh yum-3.2.22-20.el5.centos.noarch.rpm

Right there I got some missing dependencies so then I pulled them as well and since I downloaded everything into /tmp/yum I can build them all at once. Note that expat library is needed by python-elementtree however I did not find the rpm in CentOS repo:

rpm -Uvh *

Now finally yum is back:
# yum --version|head -1

But you need to install the repos. While you can do this manually and use different repos (Use one that uses GPG keys ) the easiest way is to just install an rpm to get the rpmforge repo:
rpm -Uhv

No comments: