Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

If it doesn't fit in another category, ask it here.
lshekter
Posts: 9
Joined: 2006/03/20 03:06:19
Location: Toronto, Canada

Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by lshekter » 2006/03/21 00:01:41

Hello -
First off, I want to say that I really enjoy using CentOS: Thank you! Secondly, I use CentOS 4.2. OK, here's the problem. Basically, I was a bad little CentOS user. I wanted this particular application to work that is dependent upon python 2.4, so, without really thinking about it, I downloaded, compiled, tested and then installed python 2.4. I then deleted the directories wtih python 2.3.4. Once I realized my mistake (i.e. up2date, yum etc are now broken), I uninstalled python 2.4 and re-installed python 2.3.4 the same way I installed python 2.4 (download source from python.org, compile, test and install). Unfortunately, this did not fix yum/up2date. I tried re-installed from the CentOS cd's, but I couldn't figure out exactly which rpms are required. The errors I get are this (as root):
#up2date
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/usr/sbin/up2date", line 10, in ?
import sys, os
ImportError: No module named os

os.py is present under /usr/local/lib/python2.3/os.py, so I followed the error message and did this:
# export PYTHONHOME="/usr/local/lib/python2.3"
Now when I run up2date I get this:
#up2date
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/usr/sbin/up2date", line 10, in ?
import sys, os
ImportError: No module named os

I've searched high and wide on the net for answers, and it seems like this is a fairly common problem, but no solution has been presented. Since all the pieces appear to be there, I'm sure it's just a matter of creating a missing soft link somewhere. Is there a simple fix, or do I have to re-install (gulp) CentOS?
Thanks very much, Lee

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by Lenard » 2006/03/21 01:09:28

You should not have to re-install the OS, but since this is an rpm based distro it would be better to maintain the rpm database. With that said download and install the python rpms by hand, for example from;

http://mirrors.kernel.org/centos/4.2/updates/i386/RPMS/

Needed;
python-2.3.4-14.2.i386.rpm
python-devel-2.3.4-14.2.i386.rpm

Optional;
python-docs-2.3.4-14.2.i386.rpm
python-tools-2.3.4-14.2.i386.rpm

Yum has requirements for both python-urlgrabber and python-elementtree, if you need them look here;

http://mirrors.kernel.org/centos/4.2/os/

You can install them all at once by (you should not need the '--force' switch, try it first without it);

rpm -Uvh python*.rpm --force

FYI: yum does work with python-2.4.1, you just need to re-build it from the source rpm (yum-2.4.2-2.centos4.src.rpm );

$ rpm -qa --queryformat="%{n}-%{v}-%{r}.%{arch}.rpm\n" 'python*' 'yum*' | sort
python-2.4.1-2.x86_64.rpm
python-devel-2.4.1-2.x86_64.rpm
python-elementtree-1.2.6-6.3.x86_64.rpm
python-ldap-2.0.6-4.x86_64.rpm
python-numeric-23.7-2.x86_64.rpm
python-sqlite-1.1.6-1.x86_64.rpm
python-urlgrabber-2.9.7-1.3.rf.noarch.rpm
yum-2.4.2-2.centos4.noarch.rpm

lshekter
Posts: 9
Joined: 2006/03/20 03:06:19
Location: Toronto, Canada

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by lshekter » 2006/03/21 03:48:42

Thank you. I re-installed all the python rpm's you suggested (though version 2.3.4-14.1 rather than -14.2 due to a dependency issue. I had to also install tkinter-2.3.4-14.1, tcl-8.4.7-2 and tix-8.1.4-98). I tried logging out and logging back in but my machine (IBM Thinkpad T42p) froze during the log out so I ended up re-booting. Then when I tried up2date I got this:
#up2date
Traceback (most recent call last):
File "/usr/sbin/up2date", line 11, in ?
import rpm
ImportError: No module named rpm

A quick search on the net suggests that I need rpm-python, so i do this:
#rpm -q rpm-python
rpm-python-4.3.3-11_nonptl
which suggests to me that rpm-python *is* installed. So now I'm stumped again. Any thoughts?

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by Lenard » 2006/03/21 11:23:52

[quote]
A quick search on the net suggests that I need rpm-python, so i do this:
#rpm -q rpm-python
rpm-python-4.3.3-11_nonptl
which suggests to me that rpm-python *is* installed. So now I'm stumped again. Any thoughts?[/quote]

Install newer versions of the rpm packages, for example from the ftp mirrors for CentOS 4.3;

rpm-4.3.3-13_nonptl.i386.rpm
rpm-build-4.3.3-13_nonptl.i386.rpm
rpm-devel-4.3.3-13_nonptl.i386.rpm
rpm-libs-4.3.3-13_nonptl.i386.rpm
rpm-python-4.3.3-13_nonptl.i386.rpm
rpmdb-CentOS-4.3-0.20060314.i386.rpm

lshekter
Posts: 9
Joined: 2006/03/20 03:06:19
Location: Toronto, Canada

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by lshekter » 2006/03/22 01:53:52

Well, I guess I don't understand why it's recommended that I install upgraded versions of these particular rpm's, but I'm the newbie so I'll defer to the experts. But just to confirm what I have, I did this:
# rpm -qa rpm*
rpmdb-CentOS-4.2-0.20051011
rpm-build-4.3.3-11_nonptl
rpm-devel-4.3.3-11_nonptl
rpm-4.3.3-11_nonptl
rpm-libs-4.3.3-11_nonptl
rpm-python-4.3.3-11_nonptl

I downloaded the requested rpms, exactly like the ones I already have installed except they're at 4.3.3-13 level rather than 4.3.3-11 level. So...here we go.
# rpm -Uvh rpm-4.3.3-13_nonptl.i386.rpm
error: Failed dependencies:
rpm = 4.3.3-11_nonptl is needed by (installed) rpm-build-4.3.3-11_nonptl.i386
rpm = 4.3.3-11_nonptl is needed by (installed) rpm-devel-4.3.3-11_nonptl.i386
rpm = 4.3.3-11_nonptl is needed by (installed) rpm-python-4.3.3-11_nonptl.i386
Now what? Should I force the install? Is there a particular order in which they should be installed? I tried upgrading rpm-python first, but got this:
#rpm -Uvh rpm-python-4.3.3-13_nonptl.i386.rpm
error: Failed dependencies:
rpm = 4.3.3-13_nonptl is needed by rpm-python-4.3.3-13_nonptl.i386

Thanks in advance again for the help.

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by Lenard » 2006/03/22 17:57:22

No need to force, just install them all at once;

rpm -Uvh rpm*.rpm

lshekter
Posts: 9
Joined: 2006/03/20 03:06:19
Location: Toronto, Canada

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by lshekter » 2006/03/23 01:09:15

OK. Let's give it a go:
# rpm -Uvh rpm*.rpm
Preparing... ########################################### [100%]
1:rpm-libs ########################################### [ 17%]
2:rpm ########################################### [ 33%]
3:rpm-build ########################################### [ 50%]
4:rpmdb-CentOS ########################################### [ 67%]
5:rpm-devel ########################################### [ 83%]
6:rpm-python ########################################### [100%]

Great! Didn't know you should install them all at once - have to remember that. So now up2date should work, right?!
#up2date
Traceback (most recent call last):
File "/usr/sbin/up2date", line 23, in ?
from up2date_client import up2dateErrors
File "/usr/share/rhn/up2date_client/up2dateErrors.py", line 11, in ?
import up2dateLog
File "/usr/share/rhn/up2date_client/up2dateLog.py", line 7, in ?
import config
File "/usr/share/rhn/up2date_client/config.py", line 19, in ?
from rhpl.translate import _, N_
ImportError: No module named rhpl.translate
Do I need translate.py?
Now what? Thanks again! Sorry that this seems to be going on an on...

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by Lenard » 2006/03/23 05:16:28

What are your currently installed versions of rhpl, rhnlib, rhn-applet, up2date, python and maybe up2date-gnome rpm packages?

rpm -qa 'rh*' 'python*' 'up2date*' 'yum*' | sort

Notice the single quotemarks ( ' ) in the command above. (can do a cut and paste if you want to)

Are they the same versions as the ones found where you got the 4.3.3-13_nonptl.i386 packages from, if not download the ones you need into one location. Make sure that they are the only rpm packages in that one location then install them all at once;

rpm -Uvh *.rpm

Hopefully this should finally fix your system.

Changing python is one of those things that can really mess up a system and should only be done with extreme caution and care.

$ rpm -qa 'rh*' 'rpm*' 'python*' 'up2date*' 'yum*' | sort
python-2.4.1-2
python-devel-2.4.1-2
python-elementtree-1.2.6-6.3
python-ldap-2.0.6-4
python-numeric-23.7-2
python-sqlite-1.1.6-1
python-urlgrabber-2.9.7-1.3.rf
rhpl-0.167-1
rpm-4.4.2-15.2
rpm-build-4.4.2-15.2
rpmdb-CentOS-4.3-0.20060315
rpm-devel-4.4.2-15.2
rpm-libs-4.4.2-15.2
rpm-python-4.4.2-15.2
yum-2.4.2-2.centos4

All of the installed binary packages listed above were built from the respective source rpm packages, except for therpmdb-CentOS-4.3-0.20060315 rpm package.

lshekter
Posts: 9
Joined: 2006/03/20 03:06:19
Location: Toronto, Canada

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by lshekter » 2006/03/24 00:49:34

# rpm -qa 'rh*' 'rpm*' 'python*' 'up2date*' 'yum*' | sort
python-2.3.4-14.1
python-devel-2.3.4-14.1
python-elementtree-1.2.6-4
python-sqlite-1.1.6-1
python-tools-2.3.4-14.1
python-urlgrabber-2.9.6-2
rhgb-0.14.1-8
rhn-applet-2.1.22-4.centos4
rhnlib-1.8.1-1.p23.1
rhpl-0.148.3-1
rhythmbox-0.8.8-1
rpm-4.3.3-13_nonptl
rpm-build-4.3.3-13_nonptl
rpmdb-CentOS-4.3-0.20060314
rpm-devel-4.3.3-13_nonptl
rpm-libs-4.3.3-13_nonptl
rpm-python-4.3.3-13_nonptl
up2date-4.4.50-4.centos4
up2date-gnome-4.4.50-4.centos4
yum-2.4.2-2.centos4

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Help!! Honey I broke the python! (CentOS 4.2, python 2.3.4)

Post by Lenard » 2006/03/24 01:53:39

I see three possible updates, maybe they matter maybe they do not. I cannot say for sure as you see I od not have the up2date rpm packages installed, I have no need of them.

rhn-applet-2.1.24-3.centos4
up2date-4.4.67-4.centos4
up2date-gnome-4.4.67-4.centos4

If up2date and/or yum is working they your good to go, if not then try the three updates listed above. Post one way or the other, are you 'good to go' or still have an issue?

Post Reply

Return to “CentOS 4 - Miscellaneous Questions”