Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using scipy in django with apache and mod_wsgi

I have defined a django view that uses scipy.optimize.curve_fit. This works without problems using the django development server, but when I deploy the Django application with Apache and mod_wsgi the view function gets stuck importing curve_fit:

from scipy.optimize import curve_fit

When this line is removed the rest of the app works well on the Apache server. Why does this line not work with Apache and mod_wsgi?

like image 959
gypaetus Avatar asked May 29 '13 20:05

gypaetus


2 Answers

In your WSGI file you will have something that looks like this:

<VirtualHost>
    ...
    WSGIScriptAlias / /somepath/deployment/wsgi/yoursite.wsgi
</VirtualHost>

You need to add the following line:

<VirtualHost>
    ...
    WSGIScriptAlias / /somepath/deployment/wsgi/yoursite.wsgi
    WSGIApplicationGroup %{GLOBAL}
</VirtualHost>

The explanation for that can be found here:

http://mail.scipy.org/pipermail/scipy-user/2011-November/031014.html

like image 199
James R Avatar answered Sep 17 '22 12:09

James R


many thanks for this post. I had the same Problem with spaCy and fixed it by the

<VirtualHost>
    …

    WSGIApplicationGroup %{GLOBAL}
</VirtualHost>
like image 37
Michael Avatar answered Sep 18 '22 12:09

Michael