Riky Lutfi Hamzah

@rilutham

Convey to the people even if it were a single sentence. (Sahih al-Bukhari 3461)

LinkedIn Github Twitter

Today, I accidentally delete python site-packages directory on /usr/lib/python2.7/ when trying to uninstall Django. Oh my God, it causes yum on my fedora 20 machine is not working. When I try to execute yum update, yum clean all or yum install [packages], it returns the following error.

$ sudo yum update

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:
Python 2.7.5 (default, Dec  3 2014, 07:36:20) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)]

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

How to fix?

  • Check yum version
$ rpm -qa yum
yum-3.4.3-152.fc20.noarch
  • Download yum package depend on the version and machine type (32 or 64 bit)
$ wget ftp://rpmfind.net/linux/fedora/linux/updates/20/x86_64/yum-3.4.3-152.fc20.noarch.rpm
  • Upgrade yum package
$ sudo rpm -Uvh --force yum-3.4.3-152.fc20.noarch.rpm 

yum should work now, but sometime there was a problem with urlgrabber when trying to execute yum.

   No module named urlgrabber

Do the same way as when we are solve yum problem.

$ rpm -qa python-urlgrabber
python-urlgrabber-3.9.1-32.fc20.noarch

$ wget ftp://rpmfind.net/linux/fedora/linux/releases/20/Everything/x86_64/os/Packages/p/python-urlgrabber-3.9.1-32.fc20.noarch.rpm

$ sudo rpm -Uvh --force python-urlgrabber-3.9.1-32.fc20.noarch.rpm

And … Now you can use yum like a boss.

Your turn to share:


comments powered by Disqus