ImportError: No module named cv2 — WSGI + python + apache
<p>I'm trying to run a python app on my apache Amazon EC2 server through WSGI, and I keep getting this error:</p>

<pre><code>[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5] mod_wsgi (pid=28751): Target WSGI script '/var/www/html/lumos/wsgi.py' cannot be loaded as Python module.
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5] mod_wsgi (pid=28751): Exception occurred processing WSGI script '/var/www/html/lumos/wsgi.py'.
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5] Traceback (most recent call last):
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]   File "/var/www/html/lumos/wsgi.py", line 11, in &lt;module&gt;
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]     import app
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]   File "/var/www/html/lumos/app.py", line 2, in &lt;module&gt;
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]     import main
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]   File "/var/www/html/lumos/main.py", line 1, in &lt;module&gt;
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]     import mod_one
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]   File "/var/www/html/lumos/mod_one.py", line 1, in &lt;module&gt;
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5]     import cv2
[Tue Aug 16 18:22:57 2016] [error] [client 72.219.147.5] ImportError: No module named cv2
</code></pre>

<p>This is where the cv2.so file is located (<code>sudo find / -name "cv2.so"</code>):</p>

<pre><code>/var/www/html/lumos/opencv/build/lib/cv2.so
/usr/local/lib/python2.7/dist-packages/cv2.so
</code></pre>

<p>And I have set the WSGI Python Path to be where that file is located:</p>

<pre><code>WSGIPythonPath /usr/local/lib/python2.7/site-packages/:/usr/local/lib/python2.7/dist-packages/
</code></pre>

<p>I know opencv is installed correctly because when I do the following, there's no error:</p>

<pre><code>$ python
&gt;&gt;&gt;import cv2 #no import error
&gt;&gt;&gt; 
</code></pre>

<p>When I installed mod_wsgi, this was used:</p>

<pre><code>mod_wsgi-python26-3.2-6.11.amzn1.x86_64
</code></pre>

<p>Here is my wsgi.py file</p>

<pre><code>import os, sys

sys.path.insert(0, "/var/www/html/lumos")

import bottle
import app

application = bottle.default_app() #using bottle.py web-framework
</code></pre>

<p>Here is my httpd.conf:</p>

<pre><code>WSGISocketPrefix /var/run/wsgi
WSGIPythonPath /usr/local/lib/python2.7/site-packages/:/usr/local/lib/python2.7/dist-packages/

&lt;VirtualHost *&gt;
ServerName lumos.website.me
DocumentRoot /var/www/html/lumos

WSGIDaemonProcess lumos threads=5
WSGIScriptAlias / /var/www/html/lumos/app.wsgi
        &lt;Directory "/var/www/html/lumos"&gt;
                WSGIProcessGroup lumos
                WSGIApplicationGroup %{GLOBAL}
                Order deny,allow
                Allow from all
        &lt;/Directory&gt;
&lt;/VirtualHost&gt;
</code></pre>

<p>When I run <code>python -V</code>, I get <code>Python 2.7.10.</code></p>

<p>How can I make mod_wsgi work with opencv? Any help is appreciated.</p>