Ticket #31799 (closed defect: wontfix)
python25 fails to import hashlib with user-installed modules in ~/Library/Python/2.5/site-packages
| Reported by: | gunnlaugur@… | Owned by: | jwa@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.0.3 |
| Keywords: | Cc: | jmr@… | |
| Port: | python25 py25-distribute |
Description
Platform: Lion/XCode4.2
$ port installed python25 The following ports are currently installed: python25 @2.5.6_1 (active)
Salient part of main.log:
:info:destroot File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 63, in __get_builtin_constructor :info:destroot import _sha256 :info:destroot ImportError: No module named _md5 :info:destroot shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-distribute/py25-distribute/work/distribute-0.6.24-" && /opt/local/bin/python2.5 setup.py :error:destroot Target org.macports.destroot returned: shell command failed (see log for details)
Full main.log is attached
Attachments
Change History
Changed 19 months ago by gunnlaugur@…
- Attachment py25-distribute.main.log added
comment:1 Changed 19 months ago by jmr@…
- Owner changed from macports-tickets@… to jwa@…
- Port changed from py25-distribute to python25 py25-distribute
If the _md5 module doesn't exist/work then that's a problem with python25.
comment:2 Changed 19 months ago by gunnlaugur@…
OK ... then possibly it's relevant that I just got the python25 build working today after #31697 was resolved
comment:3 Changed 19 months ago by jmr@…
I can't reproduce this. Does import hashlib work in your python2.5?
The only interesting part of your log apart from the error itself seems to be this:
:info:build failed to import Cython: dlopen(/Users/gthb/Library/Python/2.5/site-packages/Cython-0.11.1-py2.5-macosx-10.5-i386.egg/Cython/Compiler/Scanning.so, 2): no suitable image found. Did find: :info:build /Users/gthb/Library/Python/2.5/site-packages/Cython-0.11.1-py2.5-macosx-10.5-i386.egg/Cython/Compiler/Scanning.so: no matching architecture in universal wrapper
comment:4 Changed 19 months ago by gunnlaugur@…
Nope:
>>> import hashlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 136, in <module>
sha256 = __get_builtin_constructor('sha256')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 63, in __get_builtin_constructor
import _sha256
ImportError: No module named _md5
That ~/Library/Python/2.5/site-packages/Cython-0.11.1-py2.5-macosx-10.5-i386.egg bit in the install log ... that's the site-packages from an old non-macports Python installation on my machine, and I would have thought it shouldn't be touched by the macports one. Am I wrong, or is there a need to go troubleshoot why this site-packages was referenced?
comment:5 Changed 19 months ago by jmr@…
OK, so hashlib is clearly the problem (it works fine for me). I wouldn't think cython would affect any of this, and it doesn't seem to stop setup.py when the cython error occurs. I'd only go after that lead if no other explanation can be found.
Changed 19 months ago by gunnlaugur@…
- Attachment python25.main.log added
main.log from port install -k -d python25
Changed 19 months ago by gunnlaugur@…
- Attachment python25.contents.txt added
result of port contents python25
comment:6 Changed 19 months ago by gunnlaugur@…
It was indeed due to the old messy ~/Library/Python/2.5/site-packages — I clean-swept that directory (leaving only setuptools and the .pth files with all other packages stripped out) and now hashlib imports without problems and py25-distribute installs just fine.
I'm not clear on install conventions, so not sure whether the presence of cruft in ~/Library/Python/2.5/site-packages should have had this effect (or whether it was my bad).


main.log from the failed install