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:
#yum
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
http://mirror.centos.org/centos/5/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
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:

wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm
wget ftp://ftp.muug.mb.ca/mirror/centos/5.4/updates/x86_64/RPMS/expat-1.95.8-8.3.el5_4.2.x86_64.rpm
rpm -Uvh *

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

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 http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

No comments:

Followers