Problem solved!
>From a hint in
http://mail.scipy.org/pipermail/scipy-user/2011-November/031014.html I
added the following line
WSGIApplicationGroup %{GLOBAL}
to apache2/conf/httpd.conf file, restarted apache, and now scipy.optimize
import is as fast as from a command line.
HTH,
Pearu
On Friday, January 4, 2013 1:48:39 AM UTC+2, Pearu Peterson wrote:
>
> Hi,
>
> I am just another user experiencing exactly the same problem: importing
> scipy is so slow that so far I have gotten only 504-Gateway Timeout errors
> at the scipy import statements.
> In my case scipy is imported from a python module under application
> modules directory.
>
> Both `import scipy.optimize` and `from scipy import optimize` take
> forever. However `import scipy` is quick because scipy subpackages are only
> imported on demand.
> Notice that from a Python prompt `import scipy.optimize` takes about
> 0.36seconds; this demonstrates that importing scipy subpackages is a time
> consuming task (I guess there are lots of extension modules to load..).
>
> When inserting `import scipy.optimize` to wsgihandler.py (to circumvent
> import magic in gluon's custom_importer), this import also takes forever.
>
> (Before running each test I have restarted apache each time in order to be
> sure that caching modules will not affect the test results).
>
> I hope the above results make more sense to you. At least for me it seems
> that scipy import is slow at apache or wsgi level, not at web2py level.
>
> Best regards,
> Pearu
>
> On Tuesday, January 1, 2013 6:16:10 AM UTC+2, lucas wrote:
>>
>> hello one and all,
>>
>> i am using numpy and scipy pretty heavily within one of my web2py
>> applications. it takes forever and sometimes the site timeouts or crashes
>> waiting for the import of the numpy or scipy library calls. a crash may be
>> the http error 500. but when i start python through the command line,
>> import of either of these libraries is very very quick. so how do i
>> increase the speed of loading these libraries in web2py?
>>
>> once the library loads, it returns subsequent pages ultra fast. it is
>> just getting that first one page in a session to load somewhat fast and
>> reliably.
>>
>> thanx in advance. lucas
>>
>
--