No module named yum after "yum update"
Solution 1
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.
Solution 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.
Related videos on Youtube
Comments
-
Ali.az almost 2 years
Amazon EC2 Linux AMI
Python 2.7.5
yum 3.4.3I 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 ...
-
Ruben Roy over 10 yearsWhat are the permissions of the file
/etc/yum/yum.conf
? -
Ruben Roy over 10 yearsDoes 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? -
Ali.az over 10 years@RubenRoy right after I posted this I tried that and it fixed it. I thought the problem would be MUCH more complex than this.
-
-
Ali.az over 10 yearsProps to @RubenRoy who had the proper line of thinking.
-
Ryan Christensen over 9 yearsThis was the solution for me on an Amazon Linux instance after an update.
-
Lalle over 3 yearsStill the same problem after this