[csw-users] Problems with python hashlib

José Plana jplana at gmail.com
Sat Apr 17 15:02:52 CEST 2010


Hi all,

I wonder if anybody has had problems with the hashlib library of python  
used mainly for its md5 functions.
After installing CSWpython (python 2.6.4), I go this error: "ImportError:  
No module named _md5"
It can be reproduced with:

/opt/csw/lib # python
Python 2.6.4 (r264:75706, Feb 15 2010, 16:34:20) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from hashlib import md5
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/opt/csw/lib/python/hashlib.py", line 136, in <module>
     md5 = __get_builtin_constructor('md5')
   File "/opt/csw/lib/python/hashlib.py", line 63, in  
__get_builtin_constructor
     import _md5
ImportError: No module named _md5

digging a little I found that python uses  
/opt/csw/lib/python/lib-dynload/_hashlib.so so I did

# ldd /opt/csw/lib/python/lib-dynload/_hashlib.so
libssl.so.0.9.8 =>       (archivo no encontrado)
libcrypto.so.0.9.8 =>    (archivo no encontrado)
libpython2.6.so.1.0 =>   /opt/csw/lib/libpython2.6.so.1.0
libresolv.so.2 =>        /lib/libresolv.so.2
libsocket.so.1 =>        /lib/libsocket.so.1
libnsl.so.1 =>   /lib/libnsl.so.1
librt.so.1 =>    /lib/librt.so.1
libdl.so.1 =>    /lib/libdl.so.1
libpthread.so.1 =>       /lib/libpthread.so.1
libm.so.1 =>     /lib/libm.so.1
libc.so.1 =>     /lib/libc.so.1
libmp.so.2 =>    /lib/libmp.so.2
libmd.so.1 =>    /lib/libmd.so.1
libscf.so.1 =>   /lib/libscf.so.1
libaio.so.1 =>   /lib/libaio.so.1
libdoor.so.1 =>  /lib/libdoor.so.1
libuutil.so.1 =>         /lib/libuutil.so.1
libgen.so.1 =>   /lib/libgen.so.1
libm.so.2 =>     /lib/libm.so.2
/platform/SUNW,Sun-Blade-T6320/lib/libc_psr.so.1
/platform/SUNW,Sun-Blade-T6320/lib/libmd_psr.so.1

I searched for libssl.so.0.9.8 and libcrypto.so.0.9.8, provided by openssl  
(already installed):
/opt/csw/lib/python # pkg-get install openssl
No worries... you already have version 0.9.8n,REV=2010.03.25 of openssl
If you doubt this message, run 'pkg-get -U', then run
  'pkg-get upgrade openssl'

# find / -name "libssl.so.0.9.8"
/opt/csw/lib/sparcv8plus+vis/libssl.so.0.9.8
/opt/csw/lib/sparcv9/libssl.so.0.9.8

# find / -name "libcrypto.so.0.9.8"
/opt/csw/lib/sparcv8plus+vis/libcrypto.so.0.9.8
/opt/csw/lib/sparcv9/libcrypto.so.0.9.8

as both libraries where already installed, I sym-linked where they could  
be found:
# ln -s /opt/csw/lib/sparcv8plus+vis/libcrypto.so.0.9.8  
/opt/csw/lib/libcrypto.so.0.9.8
# ln -s  /opt/csw/lib/sparcv8plus+vis/libssl.so.0.9.8  
/opt/csw/lib/libssl.so.0.9.8

# ldd /opt/csw/lib/python/lib-dynload/_hashlib.so
libssl.so.0.9.8 =>       /opt/csw/lib/libssl.so.0.9.8
libcrypto.so.0.9.8 =>    /opt/csw/lib/libcrypto.so.0.9.8
libpython2.6.so.1.0 =>   /opt/csw/lib/libpython2.6.so.1.0
libsocket.so.1 =>        /lib/libsocket.so.1
libnsl.so.1 =>   /lib/libnsl.so.1
libdl.so.1 =>    /lib/libdl.so.1
libresolv.so.2 =>        /lib/libresolv.so.2
librt.so.1 =>    /lib/librt.so.1
libpthread.so.1 =>       /lib/libpthread.so.1
libm.so.1 =>     /lib/libm.so.1
libc.so.1 =>     /lib/libc.so.1
libmp.so.2 =>    /lib/libmp.so.2
libmd.so.1 =>    /lib/libmd.so.1
libscf.so.1 =>   /lib/libscf.so.1
libaio.so.1 =>   /lib/libaio.so.1
libdoor.so.1 =>  /lib/libdoor.so.1
libuutil.so.1 =>         /lib/libuutil.so.1
libgen.so.1 =>   /lib/libgen.so.1
libm.so.2 =>     /lib/libm.so.2
/platform/SUNW,Sun-Blade-T6320/lib/libc_psr.so.1
/platform/SUNW,Sun-Blade-T6320/lib/libmd_psr.so.1

which seems to work fine:

# python
Python 2.6.4 (r264:75706, Feb 15 2010, 16:34:20) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from hashlib import md5
>>>

am I missing something? Is this the correct behaviour?



More information about the users mailing list