[SciPy-Dev] import scipy.stats hangs in mod_python application

fork forkandwait@gmail....
Sun Aug 28 20:38:45 CDT 2011

Robert Kern <robert.kern <at> gmail.com> writes:

> So, has your program ever worked under mod_python? Is this an
> intermittent problem, or is it reliably repeatable? In your program,
> do you import numpy before the scipy.stats import?

Yeah, worked great until last week.

> IIRC, under certain configurations mod_python tries to instantiate
> multiple interpreters in the same process. For pure Python code, this
> is usually not too atrocious, even though it is officially
> unsupported. However, numpy maintains some global pointer tables, and
> people have run into problems trying to run multiple Python
> interpreters in the same process when the programs use numpy. There
> may be mod_python configuration options that control this behavior.

Huh.  Interesting.

> First, I would convert the entry point into your application into a
> WSGI application. Since it looks like there is only one entry point,
> doing basic form processing before passing the inputs to the
> computational code, this should be trivial. It's really just a matter
> of converting the mod_python idioms into WSGI idioms.
>   http://wsgi.org/wsgi/

The problem is that I use a lot of the convenience dispatching functions in
mod_python, and I really, really don't want to rewrite them. Speed isn't the
real issue, actually.  If I could do it over again, I would have stuck with
simple cgi, since the real computational expense is in a bunch of linear algebra
not in input/ output.

More information about the SciPy-Dev mailing list