Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
02-09-2017, 06:01 AM
|
#1
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Rep:
|
yum not working on CentOS 6.5
when I run 'yum update', I receive following 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.6.6 (r266:84292, Feb 9 2017, 15:03:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
Please help.
|
|
|
02-09-2017, 06:28 AM
|
#2
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
Have you installed another version of python by chance? I think that is what I would try, you can always scan your system to see if you have multiple versions of python with the following.
find / -type f -executable -name 'python*'
|
|
|
02-09-2017, 06:34 AM
|
#3
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by r3sistance
Have you installed another version of python by chance? I think that is what I would try, you can always scan your system to see if you have multiple versions of python with the following.
find / -type f -executable -name 'python*'
|
Oh... it seems so.
When I run that command, I see python 2.6 to 3.3 .
This is what I got.
/opt/libreoffice5.1/program/python.bin
/opt/libreoffice5.1/program/python
/usr/local/python2.6/python2.6
/usr/local/python2.6/python2.6-config
/usr/local/python2.6/python
/usr/local/lib/python3.5/config-3.5m/python-config.py
/usr/local/python2.7/bin/python2.7
/usr/local/python2.7/bin/python2.7-config
/usr/bin/bin/python3.3
/usr/bin/bin/python3.3m
/usr/bin/bin/python3.3m-config
/usr/bin/python2.6-config
/usr/lib/rpm/pythondeps.sh
/usr/lib64/gimp/2.0/plug-ins/python-eval.py
/usr/lib64/gimp/2.0/plug-ins/python-console.py
/root/Python-2.6.6/python
/root/Python-3.3.3/python
/root/Python-2.7.5/python
|
|
|
02-09-2017, 06:41 AM
|
#4
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
Well first port of call, get the default python version and see if import yum works in that. If import yum fails then it ain't the right version of python we got in use.
Code:
# python -V
Python 2.7.5
# python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>>
this is from a CentOS 7 box, so the python version will likely differ to that of CentOS 6.
Last edited by r3sistance; 02-09-2017 at 06:47 AM.
Reason: something isn't so odd actually
|
|
|
02-09-2017, 06:57 AM
|
#5
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by r3sistance
Well first port of call, get the default python version and see if import yum works in that. If import yum fails then it ain't the right version of python we got in use.
Code:
# python -V
Python 2.7.5
# python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>>
this is from a CentOS 7 box, so the python version will likely differ to that of CentOS 6.
|
Import yum is not working. Should I install other version of python now?
Python 2.6.6 (r266:84292, Feb 9 2017, 15:03:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named yum
|
|
|
02-09-2017, 07:05 AM
|
#6
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
no, the system always comes with the right version of python, we just need to check which is the right version and set yum to use that. But first let's trace what yum is using.
yum is probably using /usr/bin/python
Code:
head -n 1 /bin/yum
#!/usr/bin/python
The shebang here is important.
/usr/bin/python is usually a symbolic link, we can check that with ls -l
Code:
# ls -l /usr/bin/python
lrwxrwxrwx 1 root root 7 Oct 10 16:12 /usr/bin/python -> python2
here we go back to python2 another symbolic link
Code:
# ls -l /usr/bin/python2
lrwxrwxrwx 1 root root 9 Oct 10 16:12 /usr/bin/python2 -> python2.7
on my CentOS 7 box it points to /usr/bin/python2.7 which is where it should point for CentOS 7 and isn't a symbolic link but rather an executable
Code:
# ls -l /usr/bin/python2.7
-rwxr-xr-x 1 root root 7136 Sep 15 23:38 /usr/bin/python2.7
Can you trace back where yum is looking at for an executable? if I remember correctly for CentOS 6, it should be /usr/bin/python2.6
Last edited by r3sistance; 02-09-2017 at 07:34 AM.
Reason: misread
|
|
|
02-09-2017, 07:38 AM
|
#7
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by r3sistance
no, the system always comes with the right version of python, we just need to check which is the right version and set yum to use that. But first let's trace what yum is using.
yum is probably using /usr/bin/python
Code:
head -n 1 /bin/yum
#!/usr/bin/python
Code:
# head -n 1 /bin/yum
head: cannot open `/bin/yum' for reading: No such file or directory
The shebang here is important.
/usr/bin/python is usually a symbolic link, we can check that with ls -l
Code:
# ls -l /usr/bin/python
lrwxrwxrwx 1 root root 7 Oct 10 16:12 /usr/bin/python -> python2
Code:
# ls -l /usr/bin/python
lrwxrwxrwx 1 root root 27 Feb 9 16:30 /usr/bin/python -> /usr/local/python2.6/python
In my case, it's going to python again. Should I change it to python2 using ?
here we go back to python2 another symbolic link
Code:
# ls -l /usr/bin/python2
lrwxrwxrwx 1 root root 9 Oct 10 16:12 /usr/bin/python2 -> python2.7
on my CentOS 7 box it points to /usr/bin/python2.7 which is where it should point for CentOS 7 and isn't a symbolic link but rather an executable
Code:
# ls -l /usr/bin/python2.7
-rwxr-xr-x 1 root root 7136 Sep 15 23:38 /usr/bin/python2.7
Can you trace back where yum is looking at for an executable? if I remember correctly for CentOS 6, it should be /usr/bin/python2.6
|
Are the different versions of pythons clashing?
|
|
|
02-09-2017, 07:42 AM
|
#8
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
I suspect something has changed the location /usr/bin/python points too, /usr/bin/python needs to point at a specific version of python. So the issue is, it is loading the wrong version but the fix is simply to re-align /usr/bin/python to point back at the right version. So if you can give the output of the following I think I will be able to confirm the exactly issue.
# ls -l /usr/bin | grep python
|
|
|
02-09-2017, 10:17 AM
|
#9
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
Quote:
Originally Posted by praveenkv
Oh... it seems so.
When I run that command, I see python 2.6 to 3.3 .
|
Never ever ever install any version of python other than the default one on a CentOS/RHEL system (unless you put it somewhere completely separate, like your home directory). It's a very easy way to brick yum, and it can be very hard to come back from.
|
|
|
02-09-2017, 10:45 AM
|
#10
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
Quote:
Originally Posted by suicidaleggroll
Never ever ever install any version of python other than the default one on a CentOS/RHEL system (unless you put it somewhere completely separate, like your home directory). It's a very easy way to brick yum, and it can be very hard to come back from.
|
I was hoping/thinking in this case python can be fixed by changing the shebang in /bin/yum to #!/usr/bin/python2.6. If not, then praveenkv is going to have a very painful time here indeed. Naturally was trying to get the evidence to support my theory before actually making such changes. But yeah, Python isn't something to play around with in RHEL and RHEL based systems...
Last edited by r3sistance; 02-09-2017 at 10:46 AM.
|
|
|
02-09-2017, 02:58 PM
|
#11
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,639
|
you are aware that 6.5 is UNSUPPORTED and that the repos were moved to the historical archive " the vault"
there are NO updates for
CentOS 6.5
CentOS 6.6
CentOS 6.7
however not all the mirrors might have been deleted , but they are 2 years OUT OF DATE
CentOS 6.8 is the current and ONLY minor version supported
please check the version you are running
Code:
su -
cat /etc/redhat_release
and make sure that states it is 6.8
as to different versions
that SHOULD be a no
BUT it depends on HOW 3.3 was installed
you can have many different versions installed "side by side" but you CAN NOT!!! replace the default version
|
|
|
02-09-2017, 10:16 PM
|
#12
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by r3sistance
I suspect something has changed the location /usr/bin/python points too, /usr/bin/python needs to point at a specific version of python. So the issue is, it is loading the wrong version but the fix is simply to re-align /usr/bin/python to point back at the right version. So if you can give the output of the following I think I will be able to confirm the exactly issue.
# ls -l /usr/bin | grep python
|
This is the response.
# ls -l /usr/bin | grep python
-rwxr-xr-x 1 root root 20152 May 11 2016 abrt-action-analyze-python
lrwxrwxrwx 1 root root 48 Feb 7 16:50 kid -> ../../usr/lib/python2.6/site-packages/kid/run.py
lrwxrwxrwx 1 root root 52 Feb 7 16:50 kidc -> ../../usr/lib/python2.6/site-packages/kid/compile.py
lrwxrwxrwx 1 root root 27 Feb 9 16:30 python -> /usr/local/python2.6/python
-rwxr-xr-x. 1 root root 1418 Aug 18 21:07 python2.6-config
lrwxrwxrwx. 1 root root 16 Oct 18 12:10 python-config -> python2.6-config
-rwxr-xr-x. 1 root root 14954 Aug 17 2012 qpid-python-test
You have new mail in /var/spool/mail/root
|
|
|
02-09-2017, 10:19 PM
|
#13
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by John VV
you are aware that 6.5 is UNSUPPORTED and that the repos were moved to the historical archive " the vault"
there are NO updates for
CentOS 6.5
CentOS 6.6
CentOS 6.7
however not all the mirrors might have been deleted , but they are 2 years OUT OF DATE
CentOS 6.8 is the current and ONLY minor version supported
please check the version you are running
Code:
su -
cat /etc/redhat_release
and make sure that states it is 6.8
as to different versions
that SHOULD be a no
BUT it depends on HOW 3.3 was installed
you can have many different versions installed "side by side" but you CAN NOT!!! replace the default version
|
Yes it is saying 6.8. So, am I using CentOS 6.8 and not 6.5??
Red Hat Enterprise Linux Server release 6.8 (Santiago)
|
|
|
02-10-2017, 03:31 AM
|
#14
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
oh no... where is /usr/bin/python2 and /usr/bin/python2.6 gone? Well hopefully you have wget.
If you do, then the following maybe an option
Code:
wget http://mirror.centos.org/centos/6.8/os/x86_64/Packages/python-2.6.6-64.el6.x86_64.rpm
rpm -iv --force python-2.6.6-64.el6.x86_64.rpm
But I am not certain if that is enough, recovering python from this point is going to be extremely difficult. If the box isn't very important then I'd definitely recommend re-installing CentOS by this point.
Last edited by r3sistance; 02-10-2017 at 03:33 AM.
Reason: disabling link parsing
|
|
|
02-10-2017, 05:40 AM
|
#15
|
LQ Newbie
Registered: Feb 2016
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by r3sistance
oh no... where is /usr/bin/python2 and /usr/bin/python2.6 gone? Well hopefully you have wget.
If you do, then the following maybe an option
Code:
wget http://mirror.centos.org/centos/6.8/os/x86_64/Packages/python-2.6.6-64.el6.x86_64.rpm
rpm -iv --force python-2.6.6-64.el6.x86_64.rpm
But I am not certain if that is enough, recovering python from this point is going to be extremely difficult. If the box isn't very important then I'd definitely recommend re-installing CentOS by this point.
|
Code:
# wget http://mirror.centos.org/centos/6.8/os/x86_64/Packages/python-2.6.6-64.el6.x86_64.rpm
--2017-02-10 17:01:08-- http://mirror.centos.org/centos/6.8/...el6.x86_64.rpm
Resolving mirror.centos.org... 202.76.233.2, 2605:9000:401:102::2
Connecting to mirror.centos.org|202.76.233.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 77464 (76K) [application/x-rpm]
Saving to: “python-2.6.6-64.el6.x86_64.rpm”
100%[===============================================================>] 77,464 98.2K/s in 0.8s
2017-02-10 17:01:09 (98.2 KB/s) - “python-2.6.6-64.el6.x86_64.rpm” saved [77464/77464]
Code:
# rpm -iv --force python-2.6.6-64.el6.x86_64.rpm
error: Failed dependencies:
python-libs(x86-64) = 2.6.6-64.el6 is needed by python-2.6.6-64.el6.x86_64
python = 2.6.6-66.0.1.el6_8 is needed by python-devel-2.6.6-66.0.1.el6_8.x86_64
python < 2.6.6-66.0.1.el6_8 conflicts with python-devel-2.6.6-66.0.1.el6_8.x86_64
What does this mean?
Is there no alternative than re-installing the OS?
|
|
|
All times are GMT -5. The time now is 10:28 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|