1

I saw a lot of other questions like this but none of them answered the exact part I am having trouble with (actually installing the Python RPM). Someone on my system deleted /usr/bin/python and /usr/bin/python2.4 on my 64 bit CentOS 5.8 installation. I recompiled Python 2.4 from source, but now whenever I try to yum install anything I get the following error:

[root@cerulean-OW1 ~]# yum install httpd
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.4 (#1, Dec 16 2012, 09:16:56)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

I checked http://wiki.linux.duke.edu/YumFaq and it said the following:

If you are getting a message that yum itself is the missing module then you probably installed it incorreclty (or installed the source rpm using make/make install). If possible, find a prebuilt rpm that will work for your system like one from Fedora or CentOS. Or, you can download the srpm and do a

rpmbuild --rebuild yum*.src.rpm 

I tried going to http://rpm.pbone.net/index.php3/stat/4/idpl/17838875/dir/centos_5/com/python-2.4.3-46.el5.x86_64.rpm.html to install Python, which resulted in the following error:

[root@cerulean-OW1 ~]# rpm -Uvh python-2.4.3-46.el5.x86_64.rpm                  
error: Failed dependencies:
    python-libs-x86_64 = 2.4.3-46.el5 is needed by python-2.4.3-46.el5.x86_64

So I tried installing python-libs-x86_64, which resulted in the following:

[root@cerulean-OW1 ~]# rpm -Uvh python-libs-2.4.3-46.el5_8.2.x86_64.rpm
warning: python-libs-2.4.3-46.el5_8.2.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 192a7d7d
Preparing...                ########################################### [100%]
        package python-libs-2.4.3-46.el5_8.2.x86_64 is already installed
        file /usr/lib64/libpython2.4.so.1.0 from install of python-libs-2.4.3-46.el5_8.2.x86_64 conflicts with file from package python-libs-2.4.3-46.el5_8.2.x86_64
2
  • The line "someone deleted python" freaks me out as a fundamental breach of all ground rules of sysadminship. Of course, if that "someone" was actually you, it is not a problem - everybody errs. However, if this is not the case, you might be interested in reviewing the procedures and controls in place in your organization. Commented Dec 20, 2012 at 6:47
  • 1
    @DeerHunter I am not the sysadmin of this machine, I am just an ordinary user. The sysadmin is a friend who lets me use the server to run a site of mine. He deleted Python and now things are bad. My site is actually fine because it doesn't depend on Python. I installed a generic Python 2.4 from source which fixed the Django sites, but yum is still not happy.
    – Alex V
    Commented Dec 21, 2012 at 0:36

3 Answers 3

1

Use the --replacefiles --replacepkgs and --nodeps options to RPM to force reinstallation of these packages:

rpm --replacefiles --replacepkgs --nodeps -ivh python-libs-2.4.3-46.el5_8.2.x86_64.rpm python-2.4.3-46.el5.x86_64.rpm 

Once python is in a semi-working state again, you should use yum distro-sync to get the current versions of your system packages installed, if these happen to not be current.

7
  • I tried that RPM command, it gave me the exact same error.
    – Alex V
    Commented Dec 20, 2012 at 1:34
  • Exact same as what? Commented Dec 20, 2012 at 1:53
  • error: Failed dependencies: python-libs-x86_64 = 2.4.3-46.el5 is needed by python-2.4.3-46.el5.x86_64
    – Alex V
    Commented Dec 20, 2012 at 2:01
  • You'll have to get the matching versions of the packages, then. They seem to be mismatched. Go check your nearest CentOS repository. Commented Dec 20, 2012 at 2:02
  • What do I match with what? What exactly am I looking for in a CentOS repository? I really have no idea what I am doing with this. I am very desperate. If I go into a CentOS repo and download the RPM's I get the exact same error.
    – Alex V
    Commented Dec 20, 2012 at 2:33
1

Yes, you should just re-install python from RPM. I'd assume that you have some Centos Install media, since you obviously have it installed. If you don't:

This may help 1

Please note: you didn't mention a specific version, or architecture, so the link is a stab in the dark

3
  • I do not have the install media. I tried installing the RPM from that link, which has resulted in a strange new problem. I've edited my question to include the new problem.
    – Alex V
    Commented Dec 20, 2012 at 0:59
  • Maybe try fetching them from an actual centos mirror? mirror.thelinuxfix.com/CentOS/5/os/x86_64/CentOS Again, you're not telling us which version of Centos you're using, so we can but guess. Most mirrors won't hold RPMs for versions which have been superseded, e.g., Centos/5/ in the URL above will be for 5.8 ...
    – tink
    Commented Dec 20, 2012 at 1:08
  • Sorry. I updated my question to reflect my version of CentOS, which is 5.8, so the version isn't the problem.
    – Alex V
    Commented Dec 20, 2012 at 1:33
1

For the config you mentionned (64 bit CentOS 5.8), go for downloading your packages (python and its dependencies) from here: http://mirror.centos.org/centos/5.8/updates/x86_64/RPMS/

Then just make a rpm -ivh for what you downloaded from there, and then install yum with rpmbuild --rebuild yum*.src.rpm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .