no module named rpm - when i call yum on shell

14,035

Solution 1

I had similar problem, what I did is to manually download the old version python and reinstall it with rpm:

$ rpm -qa | grep python- | grep 2.6
$ sudo rpm -ivh --force ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/fastbugs/python-2.6.6-52.el6.x86_64.rpm

After the reinstallation of python, my yum works correctly.

Solution 2

You shouldn't touch your system's python installation. Updating the sysem's python version should be left to the distirbution.

If you need a newer version then install it, but keep it separate form the system version.

You should restore the original /usr/bin/python - it usually is a symlink (in this case to /usr/bin/python2.6.

You'll probably want to remove and reinstall python2.7, as copying modules (specially if they contain binary extensions) from one version to another can lead to problems. Install the packages you need directly using the new python version:

python2.7 setup.py ...

If you want mod_wsgi to use the newer version, use the WSGIPythonHome directive to point it to the right prefix (/usr/local).

Share:
14,035
u.unver34
Author by

u.unver34

Updated on June 27, 2022

Comments

  • u.unver34
    u.unver34 over 1 year

    I installed python 2.7.5 and mod_wsgi on centos machine linux os. And this happened:

    # yum
    Error processing line 1 of /usr/local/lib/python2.7/site-packages/abrt.pth:
    
      Traceback (most recent call last):
        File "/usr/local/lib/python2.7/site.py", line 152, in addpackage
          exec line
        File "<string>", line 1, in <module>
      ImportError: No module named abrt_exception_handler
    
    Remainder of file ignored
    Traceback (most recent call last):
      File "/usr/bin/yum", line 22, in <module>
        import yummain
      File "/usr/share/yum/yummain.py", line 22, in <module>
        import clientStuff
      File "/usr/share/yum/clientStuff.py", line 18, in <module>
        import rpm
    ImportError: No module named rpm
    

    yum module doesn't run because of rpm module doesnt exist. I don't know how can I install the python-rpm module and will it work if I install it?

    Thanks.