Hi Graham, 

#ldd mod_wsgi.so 
        libpython2.6.so.1.0 =>   
/opt/webtier/python_64/lib/libpython2.6.so.1.0
        libsocket.so.1 =>        /lib/64/libsocket.so.1
        libnsl.so.1 =>   /lib/64/libnsl.so.1
        librt.so.1 =>    /lib/64/librt.so.1
        libdl.so.1 =>    /lib/64/libdl.so.1
        libm.so.2 =>     /lib/64/libm.so.2
        libc.so.1 =>     /lib/64/libc.so.1
        libgcc_s.so.1 =>         /usr/sfw/lib/sparcv9/libgcc_s.so.1
        libmp.so.2 =>    /lib/64/libmp.so.2
        libmd.so.1 =>    /lib/64/libmd.so.1
        libscf.so.1 =>   /lib/64/libscf.so.1
        libaio.so.1 =>   /lib/64/libaio.so.1
        libdoor.so.1 =>  /lib/64/libdoor.so.1
        libuutil.so.1 =>         /lib/64/libuutil.so.1
        libgen.so.1 =>   /lib/64/libgen.so.1
        /platform/SUNW,T5440/lib/sparcv9/libc_psr.so.1
        /platform/SUNW,T5440/lib/sparcv9/libmd_psr.so.1

I compiled mod_wsgi with the following options 
*--with-apxs=/opt/webtier/Middleware/Oracle_WT1/ohs/bin/apxs 
--with-python=/opt/webtier/python_64/bin/python*, i wanted to use the 
Python i have under /opt 

The /opt/webtier/python_64 had to be build by me, because my systems python 
is an older version (2.4) + all the projects i have were developed with 
2.6.1

#/opt/webtier/python_64/bin/python -V
Python 2.6.1


The strange thing is that i can open a terminal type python and then import 
hashlib and it imports it successfully. I think that the problem is either 
with the module or with the apache but i can not pin point which is at 
fault. 

On Wednesday, February 18, 2015 at 11:22:40 PM UTC+2, Graham Dumpleton 
wrote:
>
>
> On 18/02/2015, at 11:31 PM, [email protected] <javascript:> wrote: 
>
> > I recent migrated to a new apache server and when i am trying to run my 
> wsgi project i am getting the below error. 
> > 
> > I manage to track down the problem, but i can not find how to fix it... 
> > 
> > The problem is in the 
> /opt/webtier/python_64/lib/python2.6/site-packages/django/utils/hashcompat.py,
>  
> it tries to import hashlib and it fails. Since there is a try catch block 
> in the hashcompat.py it then tries to import md5 which is deprecated .... 
> > 
> > 
> > 
> > [Wed Feb 18 13:12:21 2015] [error] <mod_wsgi.Log object at 0x1007f6870> 
> > [Wed Feb 18 13:12:22 2015] [error]  | wgtproxy | __init__ | 
> > [Wed Feb 18 13:12:22 2015] [error] | wgtproxy settings | 
> > [Wed Feb 18 13:12:22 2015] [error] 
> /opt/webtier/python_64/lib/python2.6/site-packages/django/utils/hashcompat.py:15:
>  
> DeprecationWarning: the md5 module is deprecated; use hashlib instead 
> > [Wed Feb 18 13:12:22 2015] [error]   import md5 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx] mod_wsgi 
> (pid=15944): Exception occurred processing WSGI script 
> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/django.wsgi'. 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx] Traceback (most 
> recent call last): 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx]   File 
> "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
>  
> line 230, in __call__ 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx]     
> self.load_middleware() 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx]   File 
> "/opt/webtier/python_64/lib/python2.6/site-packages/django/core/handlers/base.py",
>  
> line 42, in load_middleware 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx]     raise 
> exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % 
> (mw_module, e)) 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.xx.xx.xx] 
> ImproperlyConfigured: Error importing middleware django.middleware.common: 
> "No module named _md5" 
> > [Wed Feb 18 13:12:22 2015] [error] [client xx.x.x.xx] Request Failed for 
> : /wgtproxy, Resp Code : [500] 
> > 
> > 
> > 
> > I did a test wsgi script that the only thing is to print "Hello word" 
> but at the beginning i am also importing hashlib in order to verify that 
> the hashlib is the problem : 
> > 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx] mod_wsgi 
> (pid=15943): Exception occurred processing WSGI script 
> '/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/test.wsgi'. 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx] Traceback (most 
> recent call last): 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx]   File 
> "/opt/wgt_proxy/wgtproxyProj/wgtproxy/apache/test.wsgi", line 6, in 
> <module> 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx]     import 
> hashlib 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx]   File 
> "/opt/webtier/python_64/lib/python2.6/hashlib.py", line 136, in <module> 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx]     md5 = 
> __get_builtin_constructor('md5') 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx]   File 
> "/opt/webtier/python_64/lib/python2.6/hashlib.py", line 63, in 
> __get_builtin_constructor 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx]     import _md5 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx] ImportError: No 
> module named _md5 
> > [Wed Feb 18 14:16:32 2015] [error] [client xx.xx.xx.xx] Request Failed 
> for : /test, Resp Code : [500] 
> > 
> > 
> > Αccording to 
> https://code.google.com/p/modwsgi/wiki/ApplicationIssues#SSL_Shared_Library_Conflicts
>  
> it seems that when it tries to import hashlin it can not, the exception is 
> masked and tries to import _md5 which of course it does not exist ... 
> > 
> > The strange thing is that i can import hashlib without errors or 
> exceptions from python ... the issue is when apache+mod_wsgi tries to do it 
> it fails! 
> > 
> > I did also did the " ldd  /bin/httpd " command but my apache is not 
> referencing any libssl.so library!!! 
> > 
> > Has anybody come across this issue ??? Can someone help??? 
>
> Find the installed mod_wsgi.so file mod_wsgi in your Apache installation. 
>
> Run on it: 
>
>     ldd mod_wsgi.so 
>
> What it looks like is that mod_wsgi is compiled against the system Python 
> installation, or at least at runtime is loading the system Python library. 
> You though appear to be trying to force it to use an alternate Python 
> runtime installation under /opt. 
>
> If it is picking up the wrong Python shared library, these sorts of 
> problems can arise. 
>
> Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to