Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Amazon EC2 Linux AMI
Python 2.7.5
yum 3.4.3

I recently did a "yum update" and I'm guessing this lead to my issues. Yum now does this:

# 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:
2.7.5 (default, Sep  3 2013, 23:16:48) 
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)]

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

Looked at the yum faq and wasn't super comfortable with messing with yum rpms and messing things up more.

Googled a bit and found out that python 2.6 has the right site packages and 2.7.5 does not:

# rpm -ql python | grep "site-packages$"
# rpm -ql yum | grep "site-packages/yum$"
/usr/lib/python2.6/site-packages/yum

If I try and force yum to use 2.6 I now get this error:

# yum --version
3.4.3
CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/yum/yum.conf

Not sure how to get back up and running ...

share|improve this question
    
What are the permissions of the file /etc/yum/yum.conf? –  Ruben Roy Oct 18 '13 at 20:59
1  
Does the file exist? Usually the yum config file is at /etc/yum.conf. Can you symlink this file to /etc/yum/yum.conf if it doesnt exist? –  Ruben Roy Oct 18 '13 at 21:05
    
@RubenRoy right after I posted this I tried that and it fixed it. I thought the problem would be MUCH more complex than this. –  drfence Oct 19 '13 at 2:20

2 Answers 2

In centos, Mostly this problem is happened due to the cause of 2 versions of python are being installed in the same machine .. Centos is using python 2.6 by default with yum while there is another version of python that is installed and used in the current system by default .. that is why it is giving the following message

It's possible that the above module doesn't match the current version of Python, which is: 2.7.5 (default, Sep 3 2013, 23:16:48)

To resolve this you have to link python to version 2.6 that yum is depending on to work properly:

First remove python

$ rm /usr/bin/python

Link python with the correct version 2.6

$ ln -s /usr/bin/python2.6 /usr/bin/python

Here is a good article describing how to install different version of python in the same machine.

share|improve this answer
    
This was the solution for me on an Amazon Linux instance after an update. –  Ryan Christensen Nov 22 '14 at 23:39
up vote 1 down vote accepted

Right after I posted this I tried:

ln -s /etc/yum.conf /etc/yum/yum.conf

and this fixed it. I thought the problem would be much more complex.

share|improve this answer
    
Props to @RubenRoy who had the proper line of thinking. –  drfence Oct 19 '13 at 13:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.