$ python
Python 2.7.3 (default, Oct 8 2013, 15:53:09)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import numpy
>>> import sys
>>> sys.prefix
'/usr/local'
I configured mod_wsgi like this:
./configure --with-python=/usr/local/bin/python2.7 --with-apxs=/usr/sbin/apxs
LD_RUN_PATH=/usr/local/lib/ make
sudo make install
Ensuring that mod_wsgi is configured properly:
$ ldd /usr/lib64/httpd/modules/mod_wsgi.so
linux-vdso.so.1 => (0x00007fff36dff000)
libpython2.7.so.1.0 => /usr/local/lib/libpython2.7.so.1.0 (0x00007f9462710000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f94624e8000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f94622e4000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f94620e1000)
libm.so.6 => /lib64/libm.so.6 (0x00007f9461e5c000)
libc.so.6 => /lib64/libc.so.6 (0x00007f9461ac9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9462d15000)
Added the following to httpd.conf
WSGIPythonHome /usr/local
WSGIPythonPath /usr/local/lib/python2.7/site-packages/
Site-packages directory contains the following:
cv2.so
cv.py
distribute-0.6.35-py2.7.egg
easy-install.pth
numpy-1.7.1-py2.7-linux-x86_64.egg
README
setuptools-0.6c11-py2.7.egg-info
setuptools.pth
web.py-0.37-py2.7.egg
Here is my script:
import web
import json
import numpy as np
urls = (
'.*', 'Sample'
)
class Sample:
def GET(self):
user_data = web.input()
return json.dumps(self.perform(user_data.color, user_data.shade))
def perform (self,color, shade):
return {'color': color, 'shade': shade}
application = web.application(urls, globals()).wsgifunc()
I have the following files:
$ sudo find / -name libpython2.7.a
/usr/local/lib/python2.7/config/libpython2.7.a
/usr/local/lib/libpython2.7.a
$ sudo find / -name libpython2.7.so*
/usr/local/lib/libpython2.7.so
/usr/local/lib/libpython2.7.so.1.0
/usr/lib/libpython2.7.so
/usr/lib/libpython2.7.so.1.0
and my Python2.7 config directory has these files:
config.c
config.c.in
install-sh
libpython2.7.a
libpython2.7.so -> ../../libpython2.7.so
libpython2.7.so.1.0 -> ../../libpython2.7.so.1.0
Makefile
makesetup
python.o
Setup
Setup.config
Setup.local
I'll appreciate any help
--
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 modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/groups/opt_out.
setsebool httpd_tmp_exec on"
allowing httpd to execute code on tmp directory, in addition to other things I've tried, solved my problem. Now I can import numpy and cv2 both. So I've even started WSGI as daemon process. I got over the "Service temporary unavailable" hurdle by going over the documentation.Finally I have the following in my httpd.confWSGISocketPrefix run/wsgiWSGIDaemonProcess /processimages user=bhaarat group=bhaarat processes=20 threads=30 display-name=%{GROUP}WSGIProcessGroup /processimagesWSGIPythonHome /usr/localWSGIPythonPath /usr/local/lib/python2.7/site-packages/