0
votes

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/
2
not enough information. Where is sigtools, what is you sys.path, have you even installed sigtools, etc, etc.thebjorn
I have this file sigtools.x86_64-linux-gnu.so in my /usr/lib/python2.7/dist-packages/scipy/signal/ directory, so I'm assuming that it is installed. Another information is that if I call the same code from python directly it works, the same if I call from directly from MATLAB, not the MATLAB compiler version of it. Thanks for your helpMSO
If it is where you claim it is, then it's obvious sys.path wouldn't find it. But import scipy.signal.sigtools should work.Reti43
I presume your in Linux, can you able to located the sigtools.so lib in your Linux host?danglingpointer
It gave me this beautiful error Python Error: ImportError: cannot import name sigtools =(, there's anyway to directly give it the path to my sigtools.so?MSO

2 Answers

1
votes

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.

0
votes

Answer to your question.

Go directly to the location of where sigtools.so lib is located in your machine and do python -c "import sigtools" and then in your file, you can import it.