[SciPy-User] thread-safe scipy.optimize.leastsq

Martin Kulas kulas at mpia.de
Mon Mar 17 15:52:51 EDT 2014


Hi scipy users!

My project is using scipy.optimize.leastsq() in a multi-threaded 
applications
Several active objects invoke that methods concurrently.
As a result the following errors occurrs:

[...]
     TypeError: gaussian() takes exactly 7 arguments (2 given)
     SystemError: null argument to internal routine


[...]
   File "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py", 
line 364, in leastsq
     gtol, maxfev, epsfcn, factor, diag)
error: Error occurred while calling the Python function named <lambda>
   File "/path/to/some_algo.py", line 219, in _fitpy

     ret= optimize.leastsq(errorfunction, params, full_output=1, ftol=1)
---------------------------------------------------------------------- 
File "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py", line 
364, in leastsq

     gtol, maxfev, epsfcn, factor, diag)
Ran 1 test in 0.262serror: Internal error constructing argument list.

[...]


Is it safe to invoke scipy.optimize.lastsq() from several threads?
if not:
     Which scipy functions are thread-safe?

Thank you in advance!

Ciao
Martin





More information about the SciPy-User mailing list