Python 2.5 “ImportError: No module named _md5″ on OS X

If you are getting an error complaining about missing md5 running python 2.5 on OS X :

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/dave/Desktop/setuptools-0.6c9-py2.5.egg/setuptools/command/easy_install.py", line 21, in <module>
  File "/Users/dave/Desktop/setuptools-0.6c9-py2.5.egg/setuptools/package_index.py", line 2, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 91, in <module>
    import hashlib
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 133, in <module>
    md5 = __get_builtin_constructor('md5')
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
    import _md5
ImportError: No module named _md5

… you need to install py25-hashlib :

> sudo port install py25-hashlib



2 Responses to “Python 2.5 “ImportError: No module named _md5″ on OS X”  

  1. 1 griswolf

    port install py25-hashlib did not solve my problem on OS/X … still looking. Elsewhere, we see a suggestion to uninstall the port version of python 2.5 and reinstall from source. Ugh.

  2. 2 Michele Gerarduzzi

    Thanks for the tip!

    I had to do a sudo port install py25-zlib after that, but then it worked (on OSX 10.5.8)

Leave a Reply