473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Help: Python2.3 & Python2.4 on RHEL4 x86_64

RHEL comes with Python2.3 installed. A program I need to install
requires Python2.4

So I got Python2.4 from source and compiled it up. I configured it
with --prefix=/usr --exec-prefix=/usr and --enable-unicode=ucs4 . I
then make'd it and then make altinstall so that it didn't overwrite
the /usr/bin/Python link to /usr/bin/Python2.3 .

Well, for some reason, the arch dependent files did NOT get placed
properly in /usr/lib64/Python2.4, they instead went to
/usr/lib/Python2.4.

Also, when I tried to load pysqlite:
$ Python2.4
>>from pysqlite2 import test
I get the following traceback:

Traceback (most recent call last):
File "setup.py", line 24, in ?
import glob, os, re, sys
File "/usr/lib64/python2.3/glob.py", line 4, in ?
import fnmatch
File "/usr/lib64/python2.3/fnmatch.py", line 13, in ?
import re
File "/usr/lib64/python2.3/re.py", line 5, in ?
from sre import *
File "/usr/lib64/python2.3/sre.py", line 97, in ?
import sre_compile
File "/usr/lib64/python2.3/sre_compile.py", line 17, in ?
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch

This basically means to me that Python2.4 is loading gloab.py from
/usr/lib64/Python2.3 insead of /usr/lib/Python2.4 (even thought I
wanted to install the related files in /usr/lib64/Python2.4)

Can someome please help!

Respectfully,
Christopher Taylor
Oct 18 '06 #1
15 5524
Christopher Taylor schrieb:
This basically means to me that Python2.4 is loading gloab.py from
/usr/lib64/Python2.3 insead of /usr/lib/Python2.4 (even thought I
wanted to install the related files in /usr/lib64/Python2.4)

Can someome please help!
Can you please report what sys.path is? Do you have PYTHONPATH
set, by any chance? Python shouldn't normally look into the library
of a totally unrelated installation.

Regards,
Martin
Oct 20 '06 #2
Christopher Taylor schrieb:
This basically means to me that Python2.4 is loading gloab.py from
/usr/lib64/Python2.3 insead of /usr/lib/Python2.4 (even thought I
wanted to install the related files in /usr/lib64/Python2.4)

Can someome please help!
Can you please report what sys.path is? Do you have PYTHONPATH
set, by any chance? Python shouldn't normally look into the library
of a totally unrelated installation.

Regards,
Martin
Oct 20 '06 #3
PYTHONPATH was the problem.

I had /usr/lib64/python2.3 included and that's why it was breaking. I
took it out and it works fine now. Unfortunately, it still puts the
lib files in /usr/lib instead of /usr/lib64. I'm assuming all I need
to do is set libdir accordingly and the files will get put in
/usr/lib64. How do I then build the library files for 32bits?

Respectfully,
Christopher Taylor
Oct 23 '06 #4
Christopher Taylor schrieb:
I had /usr/lib64/python2.3 included and that's why it was breaking. I
took it out and it works fine now. Unfortunately, it still puts the
lib files in /usr/lib instead of /usr/lib64. I'm assuming all I need
to do is set libdir accordingly and the files will get put in
/usr/lib64. How do I then build the library files for 32bits?
Can you explain what "then" is? If you set libdir so that all files go
into /usr/lib64, why do want *then* that those library files are built
for 32bits? Shouldn't they be built for 64bits if they go to /usr/lib64?

In any case, you usually select the target architecture by either
selecting the right compiler, or the right compiler flags. Just set
CC to a 32-bit-compiler, and Python should be built as 32-bit binaries.

Regards,
Martin
Oct 23 '06 #5
Ok, so if I need to build the 32bit binaries, I just need to make sure
I pass the right argument through to the compiler then? (I'm trying
to build 32 bit and 64 bit binaries on the same system, but I'll wait
untill I get just the 64bit stuff built first before I tackle that)

Also, I've fooled around with passing --libdir=/usr/lib64 to the
configure script and for whatever reason, the Makefile isn't correctly
written. It always ends up copying the lib files to /usr/lib.

So I thought I'd manually edit the Makefile by editing the makefile on
lines 83 and 87 so they are now:
83: LIBDIR= $(exec_prefix)/lib64
87: SCRIPTDIR= $(prefix)/lib64

then:
make clean
make
make test
make altinstall
cd ..
python2.4

I get the following error message:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback

so then I edited /etc/profile and added
export PYTHONHOME="/usr"

then restarted and I got ride of the "Could not find platform
in/dependent libraries" errors but I still get the " 'import site'
failed " error.

I did a python2.4 -v and below is the output:
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
'import site' failed; traceback:
ImportError: No module named site
*** Now I'm lost ***

Just for sanity sakes I undid the changes to lines 83 & 87 of the make
file, did a "make clean", "make", "make test", "make altinstall",
"python2.4" followed by some goofing around and everything works fine.
So I'm guessing my manual edits of the makefile didn't go well. Any
idea what else I need to change?

Respectfully,
Christopher Taylor
Oct 23 '06 #6
Christopher Taylor schrieb:
Also, I've fooled around with passing --libdir=/usr/lib64 to the
configure script and for whatever reason, the Makefile isn't correctly
written. It always ends up copying the lib files to /usr/lib.
Ah, I see. The reason is pretty simple: Makefile.pre.in has

LIBDIR= $(exec_prefix)/lib

so it seems that LIBDIR isn't configurable.
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback

Just for sanity sakes I undid the changes to lines 83 & 87 of the make
file, did a "make clean", "make", "make test", "make altinstall",
"python2.4" followed by some goofing around and everything works fine.
So I'm guessing my manual edits of the makefile didn't go well. Any
idea what else I need to change?
You will have to debug this (can't do right now); see Modules/getpath.c,
and the definition of PYTHONPATH. It seems this isn't really supported.

Regards,
Martin
Oct 24 '06 #7
Christopher Taylor schrieb:
Also, I've fooled around with passing --libdir=/usr/lib64 to the
configure script and for whatever reason, the Makefile isn't correctly
written. It always ends up copying the lib files to /usr/lib.
Ah, I see. The reason is pretty simple: Makefile.pre.in has

LIBDIR= $(exec_prefix)/lib

so it seems that LIBDIR isn't configurable.
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback

Just for sanity sakes I undid the changes to lines 83 & 87 of the make
file, did a "make clean", "make", "make test", "make altinstall",
"python2.4" followed by some goofing around and everything works fine.
So I'm guessing my manual edits of the makefile didn't go well. Any
idea what else I need to change?
You will have to debug this (can't do right now); see Modules/getpath.c,
and the definition of PYTHONPATH. It seems this isn't really supported.

Regards,
Martin
Oct 24 '06 #8
Ah, I see. The reason is pretty simple: Makefile.pre.in has
>
LIBDIR= $(exec_prefix)/lib

so it seems that LIBDIR isn't configurable.
So you would agree that this is a bug? I'll post on Python-Dev for
further advice. I'd like to fix this for the x86_64 community.

You will have to debug this (can't do right now); see Modules/getpath.c,
and the definition of PYTHONPATH. It seems this isn't really supported.

I'll ask on Python-Dev for more details on how to fix this.

Respectfully,
Christopher Taylor
Oct 24 '06 #9
Christopher Taylor schrieb:
>Ah, I see. The reason is pretty simple: Makefile.pre.in has

LIBDIR= $(exec_prefix)/lib

so it seems that LIBDIR isn't configurable.

So you would agree that this is a bug?
I personally think this is a bug in AMD64-Linux. Libraries should
be stored in /usr/lib, binaries in /usr/bin, etc. If they need
simultaneous installation of 32-bit binaries for compatibility,
they should store them in architecture-specific directories.
I'll post on Python-Dev for
further advice. I'd like to fix this for the x86_64 community.
The x86_64 community has been using Python for a while, and
apparently has solved this problem already. You should try
to find out how they did it.

Regards,
Martin
Oct 24 '06 #10
Christopher Taylor schrieb:
>Ah, I see. The reason is pretty simple: Makefile.pre.in has

LIBDIR= $(exec_prefix)/lib

so it seems that LIBDIR isn't configurable.

So you would agree that this is a bug?
I personally think this is a bug in AMD64-Linux. Libraries should
be stored in /usr/lib, binaries in /usr/bin, etc. If they need
simultaneous installation of 32-bit binaries for compatibility,
they should store them in architecture-specific directories.
I'll post on Python-Dev for
further advice. I'd like to fix this for the x86_64 community.
The x86_64 community has been using Python for a while, and
apparently has solved this problem already. You should try
to find out how they did it.

Regards,
Martin
Oct 24 '06 #11
I personally think this is a bug in AMD64-Linux. Libraries should
be stored in /usr/lib, binaries in /usr/bin, etc. If they need
simultaneous installation of 32-bit binaries for compatibility,
they should store them in architecture-specific directories.
I disagree. From what I see, the error, as far as python is
considered, is not being able to specify the location where libs are
put, despite the fact that the --LIBDIR= option is listed. It just
happens to manifest itself in AMD64/EM64T Linux, specifically RH linux
where 64bit libs are put in /usr/lib64 and 32bit libs in /usr/lib.
The x86_64 community has been using Python for a while, and
apparently has solved this problem already. You should try
to find out how they did it.
Where might I go to look on how to get this working?

Respectfully,
Christopher Taylor

P.S. I posted on python-dev and I haven't seen my post show up yet,
nor any responces .... is that list moderated?
Oct 24 '06 #12
Christopher Taylor schrieb:
I disagree. From what I see, the error, as far as python is
considered, is not being able to specify the location where libs are
put, despite the fact that the --LIBDIR= option is listed. It just
happens to manifest itself in AMD64/EM64T Linux, specifically RH linux
where 64bit libs are put in /usr/lib64 and 32bit libs in /usr/lib.
Ok. One solution might be to remove the libdir option, then. Python
attempts to be "movable", i.e. the libraries are found relative to
the executable (via dirname(sys.executable)+"../lib/..."). If
libdir is supported, this approach must be given up - or libdir must
be given up.
>The x86_64 community has been using Python for a while, and
apparently has solved this problem already. You should try
to find out how they did it.

Where might I go to look on how to get this working?
The Linux distributions already provide Python binaries (I believe
Redhat does, too). You could study what they do to achieve that.
P.S. I posted on python-dev and I haven't seen my post show up yet,
nor any responces .... is that list moderated?
No, it should show up automatically.

Regards,
Martin
Oct 24 '06 #13
Ok. One solution might be to remove the libdir option, then. Python
attempts to be "movable", i.e. the libraries are found relative to
the executable (via dirname(sys.executable)+"../lib/..."). If
libdir is supported, this approach must be given up - or libdir must
be given up.
Well, honestly, seeings how LIBDIR doesn't do anything ... I can see
the argument for removing it.
However, I would like to propose a more flexible solution: Perhaps a
../configure parameter called LIBLOC or something like that so that
LIBDIR = $(EXEC_PREFIX)/$(LIBLOC). Of course, LIBLOC should default
to "lib". This way the flexibility you mentioned above can be
maintained and the 64bit community (which will eventually be the
entire community) can move forward with minimal hassle.
The Linux distributions already provide Python binaries (I believe
Redhat does, too). You could study what they do to achieve that.
Yes, this is true ... but they do not package the most up-to-date
version .. which I need.

Respectfully,
Christopher Taylor
Oct 24 '06 #14
Christopher Taylor schrieb:
>The Linux distributions already provide Python binaries (I believe
Redhat does, too). You could study what they do to achieve that.

Yes, this is true ... but they do not package the most up-to-date
version .. which I need.
Sure. However, I still think they have solved the problem already -
if just for older versions. The build procedure hasn't changed that
much, so the solution might be applicable to the version you want
as well.

Regards,
Martin
Oct 24 '06 #15
Does anyone have any comments on my proposed solution?
However, I would like to propose a more flexible solution: Perhaps a
./configure parameter called LIBLOC or something like that so that
LIBDIR = $(EXEC_PREFIX)/$(LIBLOC). Of course, LIBLOC should default
to "lib". This way the flexibility you mentioned above can be
maintained and the 64bit community (which will eventually be the
entire community) can move forward with minimal hassle.
Respectfully,
Christopher Taylor
Oct 24 '06 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jose Vicente Nunez Z | last post by:
Greetings, I wrote a couple of custom dummy extensions in Python (one a pure Python and the other a C) and i managed to compile and install them without a problem: $ make python2 setup.py...
1
by: Mathieu Malaterre | last post by:
Hello, I thought this would be easy but I guess I didn't get the distutil feeling. I am trying to write a setup for install my package but I don't understand how to do that. organisation: ...
0
by: oliversl | last post by:
Hi, I have a stock RHEL4 server and not that the imap_open() function no longer works. I have a local pop3 server running dovecot that I use to autenticate with this line: $imap_stream =...
0
by: Reestit Mutton | last post by:
I'm trying to get the mysqli object-oriented syntax to work in php. I understand that I have to have at least version 5 of php - I've therefore opted for version 5.1.4. The remainder of my setup is...
1
by: google | last post by:
MySQL Server is version 4.1.7 (I know I should upgrade, and I will if that is the problem but it has been working fine for 1.5 years now and only recently has started to have this problem). Server...
2
by: pssraju | last post by:
Hi, At present application was built on solaris 9 using sun studio 9 (Sun C++ 5.6) & rouguewave sorce pro 5. We are planning to port the same application onto SuSE Linux 9.5.0 using GCC 3.3.3 & RW...
2
by: Eric B. | last post by:
Hi, I appologize if this is slightly OT, but I am really struggling to figure out how to install Python2.4 on RHEL4. To make matters worse, the RHEL4 machine is a 64bit architecture. I...
0
by: Luis Speciale | last post by:
Hi u all : I'm trying to build mod_python in Leopard 10.5.4 with a cvs version from http://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk I have $ python Python 2.5.2...
2
by: Luis Speciale | last post by:
Hi I'm trying to build mod_pyton on Leopard 10.5.4 on a Mac G5 with this cvs version http://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk with this Python python Python 2.5.2...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.