[SOLVED] How to install Python2.4 on CentOS 6 when yum is broken?
Linux - NewbieThis 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.
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.
Distribution: Ubuntu (mostly), CentOS (when I have to)
Posts: 12
Rep:
How to install Python2.4 on CentOS 6 when yum is broken?
I couldn't find a CentOS-specific forum, and I didn't know if the RHEL folks would resent me posting there, so I settled on the Newbie forum. If this isn't in the right place, I hope the moderator(s) will move it to the correct place and let me know.
I somehow managed to break yum. I think it might have been when trying to install the SVN plugin in Eclipse. So far, my attempts to fix the problem have made it worse.
When I started, I was getting:
[root@centos-vm-hh ~]# yum update
Plugin "refresh-packagekit" can't be imported
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink | 11 kB 00:00
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 276, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 129, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 434, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 883, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 668, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 265, in populateSack
self.doSetup()
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 92, in doSetup
self.ayum.plugins.run('postreposetup')
File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))
File "/usr/lib/yum-plugins/fastestmirror.py", line 197, in postreposetup_hook
if downgrade_ftp and _len_non_ftp(repo.urls) == 1:
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 706, in <lambda>
urls = property(fget=lambda self: self._geturls(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 703, in _geturls
self._baseurlSetup()
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 649, in _baseurlSetup
mirrorurls.extend(list(self.metalink_data.urls()))
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 746, in <lambda>
metalink_data = property(fget=lambda self: self._getMetalink(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 733, in _getMetalink
self._metalink = metalink.MetaLinkRepoMD(result)
File "/usr/lib/python2.6/site-packages/yum/metalink.py", line 186, in __init__
root = xmlparse(filename)
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1174, in cElementTree_xmlparse
_cElementTree_import()
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
import cElementTree
ImportError: No module named cElementTree
After my initial attempts to fix this, I am now getting:
[root@centos-vm-hh ~]# yum clean all
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
[root@centos-vm-hh ~]# yum update
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
I think I need to install python 2.4, and I think it needs to be in a specific place. There are probably many other things I need to know about this, since every place I go to find out anything about CentOS or even Linux in general appears to be written in geek by somebody who assumes that any reader is already fluent in the language. I did some Unix programming about 20 years ago, but either I have completely forgotten everything, or everything has changed. Or both.
Any rate, I would sincerely appreciate it if somebody would show me how to get yum working again.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,492
Rep:
Welcome to LQ.
I guess you will have to reinstall the yum related packages manually.
The command 'cat /etc/redhat-release' will confirm, if it's CentOS 6.
I.e. CentOS 6 has no python2.4, but python-2.6.6 !
Packages :
python python-libs yum-fastestmirror python-urlgrabber yum-metadata-parser
python-elementtree python-sqlite python-iniparse rpm-python rpm yum http://www.linuxquestions.org/questi...ctor-933911/#6
→ post # 6. ( How to install with # rpm -Uvh --force <package> ).
Try to download yum manually from your browser then open terminal on the download location and type: rpm -Uvh packagename.rpm
Then install Python using yum
Try to download yum manually from your browser then open terminal on the download location and type: rpm -Uvh packagename.rpm
Then install Python using yum
yum requires python to work. Without python, yum won't run.
yum requires python to work. Without python, yum won't run.
I mean download yum using browser: http://yum.baseurl.org/
then use $ sudo rpm -Uvh packagename.rpm
Now that I look at it, no rpm package available thus: you need to download that using browser, then run make or make your own rpm.
You can also download yum rpm here: http://rpmfind.net/linux/rpm2html/search.php?query=yum
I mean download yum using browser: http://yum.baseurl.org/
then use $ sudo rpm -Uvh packagename.rpm
Now that I look at it, no rpm package available thus: you need to download that using browser, then run make or make your own rpm.
You can also download yum rpm here: http://rpmfind.net/linux/rpm2html/search.php?query=yum
I was responding to this part of your post:
Quote:
Originally Posted by Renante
Then install Python using yum
If python isn't already installed and working, he can't use yum, even if yum is installed. Therefore he can't use yum to install python. This is evidenced by his error message:
Quote:
[root@centos-vm-hh ~]# yum update
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
Yum appears to be working fine, it's python that's the problem.
I'd take the Centos DVD media and boot, from it as if doing an install, but choose the 'Update this Install' option (there's an option named something like that).
Because its running from the DVD, it won't matter that the HDD version is 'broken'.
Of course, if you haven't anything important on there, just do a re-install.
Distribution: Ubuntu (mostly), CentOS (when I have to)
Posts: 12
Original Poster
Rep:
I have downloaded and installed python 2.6.6, and now the problem appears to be different.
[root@centos-vm-hh tmp]# which python
/usr/local/bin/python
[root@centos-vm-hh tmp]# `which python` --version
Python 2.6.6
[root@centos-vm-hh tmp]# python
Python 2.6.6 (r266:84292, Aug 29 2012, 07:53:00)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@centos-vm-hh tmp]# 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:
2.6.6 (r266:84292, Aug 29 2012, 07:53:00)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
Distribution: Ubuntu (mostly), CentOS (when I have to)
Posts: 12
Original Poster
Rep:
I have located some packages that look like they might be useful:
[ ] PackageKit-yum-0.5.8-20.el6.x86_64.rpm 24-Jun-2012 22:16 156K
[ ] PackageKit-yum-plugin-0.5.8-20.el6.x86_64.rpm 24-Jun-2012 22:17 92K
Do I need to install one of these, or is there some other place I need to be looking?
I also tried:
[root@centos-vm-hh Downloads]# rpm -ivh yum-3.4.3-5.fc16.src.rpm
warning: yum-3.4.3-5.fc16.src.rpm: Header V3 RSA/SHA256 Signature, key ID a82ba4b7: NOKEY
1:yum warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
########################################### [100%]
[root@centos-vm-hh Downloads]#
This did not appear to have any effect on the problem at hand:
[root@centos-vm-hh Downloads]# 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:
2.6.6 (r266:84292, Aug 29 2012, 07:53:00)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
Not a binary package. SRC.RPMS are source code.
And not for CentOS 6. No Fedora 16 packages will do.
Please use the links to CentOS 6.3, and do not use 'rpm -ivh '.
-ivh is used when you want 2 versions at the same time.
The right command is : rpm -Uvh --force
.. to get the non working packages replaced.
Package list : Also see post # 2.
at this point
you are mixing all sorts of things
fedora 16 and cent6.3
using SOURCE"src.rpm" packages
and manually overwrote python2.6 with 2.4 ( partially overwrote i should say)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.