Search code examples
pythonmatlabmatlab-deploymentmatlab-compiler

Can't call python library when calling python from MATLAB Compiler application


I'm trying to run python scripts from a MATLAB compiled application (Using MATLAB Compiler) and for some weird reason it can't find any import from scipy. When I try to call any scipy method it gives me this error

Python Error: ImportError: cannot import name sigtools

If I call the same code from Python or MATLAB directly, it works. But not from MATLAB Compiler.

Another weird thing is that the python path that the python call from MATLAB sees is correct, so what could cause this?

EDIT My python path

/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0

I have the file sigtools.x86_64-linux-gnu.so in

/usr/lib/python2.7/dist-packages/scipy/signal/

Solution

  • I found the solution of the problem. The version of libstdc++ provided by MATLAB runtime environment is too old for importing some python libraries. It should libstdc++.so.6 version 3.4.21. I've replaced the file libstdc++.so.6 with an updated version (3.4.21) in v901/sys/os/glnxa64/ which is the MATLAB runtime directory.