Dave Perrett

Python 2.5 "ImportError: No Module Named _md5" on OS X

linux, osx, programming, python, quickie

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

1
2
3
4
5
6
7
8
9
10
11
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 :

1
> sudo port install py25-hashlib