python2.5 importerror on md5

S

samn

i compiled and installed the release version of python 2.5 for linux to
a directory accessible to 2 computers, configured with
--prefix=/usr/arch (which is accessible to both machines). the
installation went fine and when i run python on one machine i can do
from hashlib import * without a problem. on the other machine i get the
following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/arch/lib/python2.5/hashlib.py", line 104, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/arch/lib/python2.5/hashlib.py", line 31, in
__get_builtin_constructor
import _md5
ImportError: No module named _md5

I have the file md5.py , md5.pyo , and md5.pyc in
/usr/arch/lib/python2.5/ so I don't know why python is having a problem
finding the md5 module...

The sys.path is equal on both machines :
['', '/usr/arch/lib/python25.zip', '/usr/arch/lib/python2.5',
'/usr/arch/lib/python2.5/plat-linux2',
'/usr/arch/lib/python2.5/lib-tk',
'/usr/arch/lib/python2.5/lib-dynload',
'/usr/arch/lib/python2.5/site-packages',
'/usr/arch/lib/python2.5/site-packages/gtk-2.0']

Here is the version info :
Python 2.5 (r25:51908, Oct 23 2006, 13:38:11)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-56)] on linux2

If anyone has encountered similar problems or knows of a way to
fix/suggestions please let me know.

Thanks in advance.
Sam
 
S

Steve Holden

samn said:
i compiled and installed the release version of python 2.5 for linux to
a directory accessible to 2 computers, configured with
--prefix=/usr/arch (which is accessible to both machines). the
installation went fine and when i run python on one machine i can do
from hashlib import * without a problem. on the other machine i get the
following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/arch/lib/python2.5/hashlib.py", line 104, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/arch/lib/python2.5/hashlib.py", line 31, in
__get_builtin_constructor
import _md5
ImportError: No module named _md5

I have the file md5.py , md5.pyo , and md5.pyc in
/usr/arch/lib/python2.5/ so I don't know why python is having a problem
finding the md5 module...

The sys.path is equal on both machines :
['', '/usr/arch/lib/python25.zip', '/usr/arch/lib/python2.5',
'/usr/arch/lib/python2.5/plat-linux2',
'/usr/arch/lib/python2.5/lib-tk',
'/usr/arch/lib/python2.5/lib-dynload',
'/usr/arch/lib/python2.5/site-packages',
'/usr/arch/lib/python2.5/site-packages/gtk-2.0']

Here is the version info :
Python 2.5 (r25:51908, Oct 23 2006, 13:38:11)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-56)] on linux2

If anyone has encountered similar problems or knows of a way to
fix/suggestions please let me know.
I believe the _md5 module (as opposed to the md5 module) is a compiled
extension. I'm guessing the import succeeds on the machine you used to
build python.

Try

import _md5
print _md5.__file__

and see if you can find out where it's being loaded from. You'll
probably find that you also need to tailor the sysprefix parameter, or
some such.

regards
Steve
 
S

samn

I believe the _md5 module (as opposed to the md5 module) is a compiled
extension. I'm guessing the import succeeds on the machine you used to
build python.

Try

import _md5
print _md5.__file__

and see if you can find out where it's being loaded from. You'll
probably find that you also need to tailor the sysprefix parameter, or
some such.

You are correct that import md5 works fine on the machine that I
compiled on and only has problems on the other machine. I wasn't able
to import _md5 , even on the machine I compiled on.
Here's what I get on the machine I compiled on:
Python 2.5 (r25:51908, Oct 23 2006, 13:38:11)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-56)] on linux2
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
/usr/arch/lib/python2.5/md5.py

sys.prefix is equal on both machines:'/usr/arch'

thanks for any help
sam
 
S

Steve Holden

samn said:
I believe the _md5 module (as opposed to the md5 module) is a compiled
extension. I'm guessing the import succeeds on the machine you used to
build python.

Try

import _md5
print _md5.__file__

and see if you can find out where it's being loaded from. You'll
probably find that you also need to tailor the sysprefix parameter, or
some such.


You are correct that import md5 works fine on the machine that I
compiled on and only has problems on the other machine. I wasn't able
to import _md5 , even on the machine I compiled on.
Here's what I get on the machine I compiled on:
Python 2.5 (r25:51908, Oct 23 2006, 13:38:11)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-56)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Traceback (most recent call last):

/usr/arch/lib/python2.5/md5.py

sys.prefix is equal on both machines:

'/usr/arch'

thanks for any help
sam
Try looking for md5.so - it'll probably be somewhere like
/usr/lib/python2.5/lib-dynload. When I said sys-prefix I meant the
--exec-prefix configuration option, but actually I'm not sure what
determines where shared libraries end up.

At least knowing what you are looking for should help. This may affect
other modules that use extension support.

regards
Steve
 
S

samn

i think the problem is different versions of openssl on the two
machines , 0.9.7a and 0.9.8b
 
C

Chris Lambacher

i think the problem is different versions of openssl on the two
machines , 0.9.7a and 0.9.8b
I second that this is the likely culprit. I got bit by it while trying to
do cross compile. The module build process assumes a couple of locations that
a particular library might be and takes the first one it finds, regardless of
which one you actually want it to use. I ended up making modifications to
what modules were installed to get md5 to finally import.

My experiences are outlined at this page:
http://whatschrisdoing.com/blog/2006/10/06/howto-cross-compile-python-25/

-Chris
 
S

samn

Chris said:
I second that this is the likely culprit. I got bit by it while trying to
do cross compile. The module build process assumes a couple of locations that
a particular library might be and takes the first one it finds, regardless of
which one you actually want it to use. I ended up making modifications to
what modules were installed to get md5 to finally import.

My experiences are outlined at this page:
http://whatschrisdoing.com/blog/2006/10/06/howto-cross-compile-python-25/

-Chris

thanks , i actually ended up installing openssl 0.9.8b on the machine
with version 0.9.7a and then reinstalling hashlib (after taking out
part of setup.py that doesn't let you install for python >= 2.5) in the
right place and then it worked
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top