Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am currently running a Centos 6.4 server, with Apache 2.2.15 and mod_wsgi 3.2. The server is hosting a django-based site (django 1.5.1, python 2.6.6). Everything was running fine until I installed scipy 0.12.0 via pip. Now, when I attempt to load the django app, the server does not respond, and it appears that child httpd processes that are spawned hang. Looking through my logs (/var/logs/httpd/error_log, my vhost error.log, and my system logs) yield no errors.

If I load my models, etc.. via the django shell, everything works fine, which leads me to believe it is a mod_wsgi issue.

Any thoughts on how to start troubleshooting this?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Some third party packages for Python which use C extension modules, and this includes scipy and numpy, will only work in the Python main interpreter and cannot be used in sub interpreters as mod_wsgi by default uses. The result can be thread deadlock, incorrect behaviour or processes crashes. These is detailed in:

The workaround is to force the WSGI application to run in the main interpreter of the process using:

WSGIApplicationGroup %{GLOBAL}

If running multiple WSGI applications on same server, you would want to start investigating using daemon mode because some frameworks don't allow multiple instances to run in same interpreter. This is the case with Django. Thus use daemon mode so each is in its own process and force each to run in main interpreter of their respective daemon mode process groups.

share|improve this answer
thank you much! That did the trick. – MarkD Jun 7 '13 at 22:31

Another solution that fit my way of configuring WSGI was changing the WSGIScriptAlias line:

WSGIDaemonProcess website user=user group=group python-path=/path/to/venv/website:/path/to/venv/lib/python2.7/site-packages
WSGIScriptAlias /website /path/to/venv/website/ process-group=website application-group=%{GLOBAL}

<Location /website>
        WSGIProcessGroup website

<Directory /path/to/venv/website>
        WSGIScriptReloading On
                Allow from all
                Require all granted

note the attributes

process-group=website application-group=%{GLOBAL}

which are usually not required

share|improve this answer
You can drop WSGIScriptReloading directive as that defaults to on and generally would never need to be turned off. Due to using process-group option to WSGIScriptAlias, you can also drop the WSGIProcessGroup directive. – Graham Dumpleton Jun 8 at 23:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.