Tags

, , , ,

CentOS 5.9 comes with Python 2.4.3 installed. I installed a different Python version (2.7) and all hell broke loose. Yum stopped working with errors like a particular Python module was missing.

I searched for fixing this problem on various forums and found no useful help. Finally, I could fix it with following actions:

Delete conflicting Python

  • Search other Python distributions on your machine. Run $whereis python and delete all directories that point to any Python version but 2.4.
  • Delete contents of /usr/lib/python2.4/site-packages/yum/ by running $rm -rf /usr/lib/python2.4/site-packages/yum/*
  • Delete contents of /usr/lib/python2.4/site-packages/rpmUtils/*
  • You will start seeing errors as No module named yum now.

Install YUM

  • Figure out what yum version does your machine expects. $rpm -q yum.
  • On my machine, output was: yum-3.2.22-40.el5.centos
  • Unzip and build it.
  • $make
    • You might see following error:
      for d in rpmUtils yum etc docs po; do make PYTHON=python -C $d; [ $? = 0 ] || exit 1 ; done
      intltool-update –gettext-package=yum –pot
      make[1]: intltool-update: Command not found
      make[1]: *** [yum.pot] Error 127
      make[1]: Leaving directory `/root/work/packages/yum-3.2.22/po’
      make: *** [subdirs] Error 1
    • I fixed the above error by changing the yum-3.2.22/Makefile and removing dependency “po” in the first line. It is harmless. If you start installing the intltool rpm, it ends up in many dependencies. It looked futile to me.
    • Try make again. It will work now.
  • Now, do make install
  • This will copy yum related modules in your Python site-packages.

Install YUM dependencies

  • Now, visit this link
  • Look at CentOS 5.9 section and copy all lines for RPM installation in a file.
  • Add –force to each rpm installation request as follows:

$~/work/packages/yum-3.2.22# rpm -Uvh –force http://mirror.centos.org/centos-5/5.9/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm

  • yum should work now
Advertisements