There are several possibilities if you want to distribute only a subset SciPy code with your code (and in particular scipy.optimize.fsolve
),
- Look at the SciPy source code and copy only the files that are needed for the
fsolve
function. After a quick glance that would be at least, scipy/optimize/optimize.py
, scipy/optimize/minpack.py
, scipy/optimize/_minpack.so/.pyd
(but maybe I missed a couple).
- In simpler approach, remove folder by folder unused parts in the scipy install directory (particularly those that take a lot of space), including
scipy/weave
, scipy/sparse
, scipy/linalg
etc.
- Write a simple wrapper around the
scipy.optimize.fsolve
and compile it to C code with cython, this should produce an independent .pyd/.so
There should be a python module to do this automatically, for instance pyinstaller
does include only the required modules in the binary executable it produces. So you would need an equivalent of pyinstaller
that produces dynamic libraries.