apache pointing to the wrong version of python on ubuntu how do I change?

Posted by one on Server Fault See other posts from Server Fault or by one
Published on 2013-11-03T23:54:55Z Indexed on 2013/11/04 3:57 UTC
Read the original article Hit count: 554

Filed under:
|
|

I am setting up a flask application on and Ubuntu 12.04.3 LTS EC2 instance and everything seemed to be working well (i.e. I could get to the webpage via the publicly available url) until I tried to import a module (e.g. numpy) and realised the apache python differs from the one I used to compile the mod_wsgi and also the one I am using

I am running apache2.

The apache2 logs show the warnings (specifically the last line shows the path hasnt changed):

[warn] mod_wsgi: Compiled for Python/2.7.5.
[warn] mod_wsgi: Runtime using Python/2.7.3.
[warn] mod_wsgi: Python module path '/usr/lib/python2.7/:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib$

I have tried to set the path in my virtual host conf (my python is located in /home/ubuntu/anaconda/bin along with all of the other libraries):

WSGIPythonHome /home/ubuntu/anaconda
WSGIPythonPath /home/ubuntu/anaconda

<VirtualHost *:80>
                ServerName xx-xx-xxx-xxx-xxx.compute-1.amazonaws.com
                ServerAdmin [email protected]
                WSGIScriptAlias / /var/www/microblog/microblog.wsgi
                <Directory /var/www/microblog/app/>
                        Order allow,deny
                        Allow from all
                </Directory>
                Alias /static /var/www/microblog/app/static
                <Directory /var/www/FlaskApp/FlaskApp/static/>
                        Order allow,deny
                        Allow from all
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

But I still get the warnings and the apache python path hasnt changed - where do I need to put the relevant directives to point apache at my python version and modules (e.g. scipy, numpy etc)?

Separately, could I have avoided this using virtual environments?

Thanks in advance.

© Server Fault or respective owner

Related posts about apache2

Related posts about ubuntu