Yum doesn't work after python installation

Issues related to applications and software problems
Post Reply
murabio
Posts: 5
Joined: 2015/07/06 20:12:14

Yum doesn't work after python installation

Post by murabio » 2015/07/06 20:28:13

Hi,

I have a problem with yum.

After python installation it returns me this error:

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, Jul 6 2015, 12:37:31)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]

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

How can I restore the previus settings?

Thanks

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Yum doesn't work after python installation

Post by gerald_clark » 2015/07/07 01:28:36

Python is the base for many of the system utilities including yum.
You cannot replace it with a different version.
You can only install parallel versions.
Depending on how far along in your configuration you are, it may be easiest to back up your data and reinstall.

murabio
Posts: 5
Joined: 2015/07/06 20:12:14

Re: Yum doesn't work after python installation

Post by murabio » 2015/07/07 14:33:18

Thanks a lot gerald_clark,

I'm interested to try to solve the problem instead to reinstall everything, I searched some guides but none helped me.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Yum doesn't work after python installation

Post by TrevorH » 2015/07/07 14:36:44

First step is to undo your source python install. I believe that it has a make uninstall target that you can use to do that. Once that is done, run hash -r so that bash forgets where it found your source-built copy of python. If you didn't overwrite the system python with yours then hopefully that's all you need to do. If you did then you'll need to use something like rpm -qa python to get a list of the python packages currently installed and then download those rpms from a CentOS mirror and use rpm to reinstall them.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

murabio
Posts: 5
Joined: 2015/07/06 20:12:14

Re: Yum doesn't work after python installation

Post by murabio » 2015/07/07 20:16:16

Thanks for the help TrevorH,

rpm -qa python

returns just:
python-2.7.5-18.el7_1.1.x86_64

I have downloaded the rpm and when I try to install it with:

rpm -Uvh python-2.7.5-18.el7_1.1.x86_64.rpm

unfortunately it returns that's already installed

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Yum doesn't work after python installation

Post by gerald_clark » 2015/07/07 20:27:45

Add --force to the options.

murabio
Posts: 5
Joined: 2015/07/06 20:12:14

Re: Yum doesn't work after python installation

Post by murabio » 2015/07/07 20:36:41

Ok, using
rpm -Uvh --force python-2.7.5-18.el7_1.1.x86_64.rpm

Install it.
But the problem is the same, also after a reboot

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, Jul 6 2015, 12:37:31)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]

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

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Yum doesn't work after python installation

Post by TrevorH » 2015/07/07 20:59:28

Did you first uninstall the source build and run hash -r? Until you do that, your own build will be found first.

You're missing a \* off the end of the rpm -qa python\* but I see that was my error. It should be there to see the other python packages that are installed.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

murabio
Posts: 5
Joined: 2015/07/06 20:12:14

Re: Yum doesn't work after python installation

Post by murabio » 2015/07/07 22:10:04

I've unistalled the source build (deleting, after a backup, links and files starting with python* in /usr/local/bin) and run hash -r but without success.
I've run rpm -qa python\* and it returned:

rpm -qa python\*
python-slip-dbus-0.4.0-2.el7.noarch
python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
python-pycurl-7.19.0-17.el7.x86_64
python-libs-2.7.5-18.el7_1.1.x86_64
python-backports-1.0-8.el7.x86_64
python-slip-0.4.0-2.el7.noarch
python-devel-2.7.5-18.el7_1.1.x86_64
python-iniparse-0.4-9.el7.noarch
python-decorator-3.4.0-3.el7.noarch
python-pyudev-0.15-6.el7.noarch
python-urlgrabber-3.10-6.el7.noarch
python-configobj-4.7.2-7.el7.noarch
python-setuptools-0.9.8-3.el7.noarch
python-2.7.5-18.el7_1.1.x86_64

I've downloaded the rpm and installed them

rpm -Uvh --force python*
1:python-libs-2.7.5-18.el7_1.1 ################################# [ 8%]
2:python-2.7.5-18.el7_1.1 ################################# [ 17%]
3:python-backports-1.0-8.el7 ################################# [ 25%]
4:python-backports-ssl_match_hostna################################# [ 33%]
5:python-setuptools-0.9.8-3.el7 ################################# [ 42%]
6:python-decorator-3.4.0-3.el7 ################################# [ 50%]
7:python-slip-0.4.0-2.el7 ################################# [ 58%]
8:python-slip-dbus-0.4.0-2.el7 ################################# [ 67%]
9:python-pyudev-0.15-6.el7 ################################# [ 75%]
10:python-configobj-4.7.2-7.el7 ################################# [ 83%]
11:python-devel-2.7.5-18.el7_1.1 ################################# [ 92%]
12:python-urlgrabber-3.10-6.el7 ################################# [100%]
13:python-decorator-3.4.0-3.el7 ################################# [108%]

1:python-pycurl-7.19.0-17.el7 ################################# [100%]
1:python-iniparse-0.4-9.el7 ################################# [100%]

it give me the same problem also after a system's reboot

Post Reply