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. TIA |
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> ). Links, CentOS 6 http://mirror.centos.org/centos/6.3/os/ Updates http://mirror.centos.org/centos/6.3/updates/ . |
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 |
Quote:
|
you can download and use fedora rpm here: http://www.python.org/getit/releases/2.4/rpms/
then use sudo rpm -ivh packagename.rpm to install |
Quote:
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 |
Quote:
Quote:
Quote:
|
yum and Python GO HAND IN HAND
the VERSION of python in the Cent update/base repo IS REQUIRED you CAN NOT CHANGE IT!!!! now you can install a SECOND or third version of python next to the REQUIRED version you MUST and i do mean MUST use the rpm's that are in the cent repo !!!!! CentOs 6.3 is it so manually reinstall the python rpms the mirrors ARE on the cent site http://www.centos.org/modules/tinyco...ndex.php?id=30 a FAST USA mirror ( Arctic Region Supercomputing Center) http://mirrors.arsc.edu/centos/ cent os 6.3 ( guessing the 64 bit ) http://mirrors.arsc.edu/centos/6.3/os/x86_64/Packages/ --- python-2.6.6-29.el6_2.2.i686.rpm --- python-2.6.6-29.el6_2.2.x86_64.rpm now if you NEED a OLD python 2.4 for a old program you can install python24 along side 2.6 |
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. |
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)] If you cannot solve this problem yourself, please go to the yum faq at: http://yum.baseurl.org/wiki/Faq So, I went looking for yum: [root@centos-vm-hh tmp]# find / -name yum 2>/dev/null /var/cache/yum /var/lib/yum /usr/bin/yum /usr/share/PackageKit/helpers/yum /usr/lib/python2.6/site-packages/yum /etc/logrotate.d/yum /etc/yum /home/howard/Downloads/yum-3.4.3/yum [root@centos-vm-hh tmp]# find / -name yum.py 2>/dev/null /usr/lib/python2.4/site-packages/sos/plugins/yum.py /usr/lib/python2.6/site-packages/sos/plugins/yum.py /home/howard/Downloads/yum-3.4.3/bin/yum.py [root@centos-vm-hh tmp]# What am I doing wrong? |
Knee jerk reaction is to say "Fix Yum."
|
Quote:
|
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)] If you cannot solve this problem yourself, please go to the yum faq at: http://yum.baseurl.org/wiki/Faq |
# 13
Quote:
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. Link x86_64 http://mirror.centos.org/centos/6.3/os/x86_64/Packages/ Updates x86_64 http://mirror.centos.org/centos/6.3/...6_64/Packages/ . |
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) it might be ,at this point, easier to reinstall |
All times are GMT -5. The time now is 09:23 PM. |