[uWSGI] uWSGI - No module named _md5 error when working with virtualenv

Roberto De Ioris roberto at unbit.it
Mon Nov 15 09:58:40 CET 2010


Il giorno 15/nov/2010, alle ore 09.40, Michael Kang ha scritto:

> It's very strange error:
> 
> /home/k4/Envs/k4/lib/python2.6/site-packages/django/utils/hashcompat.py:15: DeprecationWarning: the md5 module is deprecated; use hashlib instead
>   import md5
> Traceback (most recent call last):
>   File "/home/k4/Envs/k4/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 230, in __call__
>     self.load_middleware()
>   File "/home/k4/Envs/k4/lib/python2.6/site-packages/django/core/handlers/base.py", line 42, in load_middleware
>     raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)
> django.core.exceptions.ImproperlyConfigured: Error importing middleware django.middleware.common: "No module named _md5"
> 
> In the hashcompat.py, there are just 9 lines:
> try:
>     import hashlib
>     md5_constructor = hashlib.md5
>     sha_constructor = hashlib.sha1
> except ImportError:
>     import md5
>     md5_constructor = md5.new
>     import sha
>     sha_constructor = sha.new
> 
> But I can import hashlib successfully. The program should never run import md5 and sha.


Have you tried launching

PATH_TOVENV/bin/python

and manually importing hashlib ?

--
Roberto De Ioris
http://unbit.it



More information about the uWSGI mailing list