Ticket #19461 (closed defect: invalid)
py26-xml: ImportError: No module named _md5
| Reported by: | akim.demaille@… | Owned by: | macports-tickets@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Port: | py26-xml |
Description
Hi,
This error was already reported in other contexts for Python 2.5, and people were told to install py25-hashlib. But there is no such thing for py26.
akim@montero ~/src/kernel $ python2.6 2 14:10:08
Python 2.6.1 (r261:67515, Apr 2 2009, 14:20:17)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.sax import saxexts, saxlib, saxutils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/_xmlplus/sax/saxutils.py", line 8, in <module>
import os, urlparse, urllib2, types
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 91, in <module>
import hashlib
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
>>>
Change History
comment:2 in reply to: ↑ 1 ; follow-up: ↓ 3 Changed 4 years ago by akim.demaille@…
Replying to blb@…:
Note that there is no py26-hashlib as its functionality should be built into python26. Does the following file exist on your install?
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_hashlib.so
Yes, it does:
$ ls -l /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_hashlib.so -rwxr-xr-x 2 root admin 21748 Apr 2 14:20 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_hashlib.so
But there is no _md5.so, shouldn't there be one?
I have the same ports as you:
$ port echo active | grep py py26-docutils @0.5_1 py26-libxml2 @2.6.21_0 py26-xml @0.8.4_0 python26 @2.6.1_2 python_select @0.2.1_0+darwin_9 swig @1.3.38_0+perl+php5+python+ruby xorg-libxcb @1.2_0+python26 xorg-xcb-proto @1.4_0+python26
and still the error.
$ python2.6
Python 2.6.1 (r261:67515, Apr 2 2009, 14:20:17)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.sax import saxexts, saxlib, saxutils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/_xmlplus/sax/saxutils.py", line 8, in <module>
import os, urlparse, urllib2, types
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 91, in <module>
import hashlib
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
I don't know what to look for. I am no Python programmer, I don't know how to ask it its path.
comment:3 in reply to: ↑ 2 Changed 4 years ago by akim.demaille@…
All this boils down to this, I guess:
$ python2.6
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import md5
__main__:1: DeprecationWarning: the md5 module is deprecated; use hashlib instead
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/md5.py", line 10, in <module>
from hashlib import md5
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
comment:4 follow-up: ↓ 5 Changed 4 years ago by blb@…
Hmm, perhaps the build didn't properly link to OpenSSL; what is the result of running the following two commands?
$ python2.6 -c 'import _hashlib;print dir(_hashlib)' $ port installed openssl
comment:5 in reply to: ↑ 4 Changed 4 years ago by akim.demaille@…
Replying to blb@…:
Hmm, perhaps the build didn't properly link to OpenSSL; what is the result of running the following two commands?
$ python2.6 -c 'import _hashlib;print dir(_hashlib)' $ port installed openssl
$ python2.6 -c 'import _hashlib;print dir(_hashlib)' Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_hashlib.so, 2): Library not loaded: /opt/local/lib/libssl.1.0.0.dylib Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_hashlib.so Reason: image not found $ port installed openssl The following ports are currently installed: openssl @0.9.8k_0 (active) $ ls /opt/local/lib/libssl.* /opt/local/lib/libssl.0.9.8.dylib /opt/local/lib/libssl.a /opt/local/lib/libssl.dylib
So I reinstalled python26 and now this works properly. My problems with ssl.1.0.0 were reported in another ticket (http://trac.macports.org/ticket/19124).
Now:
>>> import md5; __main__:1: DeprecationWarning: the md5 module is deprecated; use hashlib instead
It does work now. So I basically had you debug my machine :( Sorry about that.


Your example import works fine for me:
This is with the following python26 and py26-xml installed:
Note that there is no py26-hashlib as its functionality should be built into python26. Does the following file exist on your install?