Opened 12 years ago

Closed 12 years ago

#19905 closed defect (invalid)

ImportError: No module named _md5

Reported by: ajb78@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc: skymoo (Adam Mercer)
Port: python25

Description (last modified by skymoo (Adam Mercer))

When I try to import pylab from the macports python I get the following error:

import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/lib/python2.5/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/opt/local/lib/python2.5/site-packages/matplotlib/pylab.py", line 206, in <module>
    from matplotlib import mpl  # pulls in most modules
  File "/opt/local/lib/python2.5/site-packages/matplotlib/mpl.py", line 11, in <module>
    from matplotlib import finance
  File "/opt/local/lib/python2.5/site-packages/matplotlib/finance.py", line 13, in <module>
    from md5 import md5 #Deprecated in 2.5
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/md5.py", line 6, in <module>
    from hashlib import md5
  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

I have py25-hashlib installed and interestly enough I can import numpy (which has a dependence on py25-hashlib). I also have a problem trying to run ipython and now even trying to install the port. I can the same error.

Change History (9)

comment:1 Changed 12 years ago by blb@…

Port: python25 added

First note that python25 should now include hashlib, so py25-hashlib is no longer necessary (see ticket #12369).

Did you happen to have openssl 1.0.0 installed for a brief time? If so, that could be causing the issue; what is the output from

otool -L /opt/local/lib/python2.5/site-packages/_hashlib.so

If you upgrade python25, then that file will be moved:

otool -L /opt/local/lib/python2.5/lib-dynload/_hashlib.so

though if you do upgrade python25, that will most likely fix the issue if the older hashlib were linked to openssl 1.0.0 briefly.

comment:2 Changed 12 years ago by ajb78@…

Ah, I now see that py25-hashlib is just a stub.

Unfortunately it appears that I am missing _hashlib.so all-together, so likely this is the cause of my problem. I just checked and I am at the latest version of python. In fact, I tried to uninstall and reinstall and yet _hashlib.so is still missing.

comment:3 Changed 12 years ago by mf2k (Frank Schima)

So what is the output of the following command for you?

port installed python25 py25-matplotlib

I can import pylab, but not _md5.

comment:4 Changed 12 years ago by ajb78@…

The output is:

py25-matplotlib @0.98.5.3_0+darwin_9+ghostscript+gtk2+latex (active) python25 @2.5.2_7+darwin_9 (active)

comment:5 Changed 12 years ago by skymoo (Adam Mercer)

Cc: ram@… added

Cc Me!

comment:6 Changed 12 years ago by skymoo (Adam Mercer)

Description: modified (diff)

You need to update your python25 port, the latest is 2.5.4_5

comment:7 Changed 12 years ago by ajb78@…

Ooops, my mistake. I found that yes indeed my python was out of date. I had my own port for python that I had installed a number of months ago to correct for a particular bug in python and somehow this meant that python stopped being updated. Thank you very much for the help, and I'm sorry for this mistake.

comment:8 Changed 12 years ago by blb@…

If there's a python bug is there a ticket for the port(s) or at http://bugs.python.org/ ?

comment:9 Changed 12 years ago by mf2k (Frank Schima)

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.