matlab.engine, Python2.7, matlab 2018 segfault error

3 次查看(过去 30 天)
I am trying to import matlab.engine in my python code. I get the following error:
import matlab.engine File "/usr/lib/python2.7/site-packages/matlab/engine/__init__.py", line 62, in module 'MathWorks Technical Support for assistance: %s' % e) EnvironmentError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/software/matlab2018/extern/engines/python/dist/matlab/engine/glnxa64/matlabengineforpython2_7.so)
If I move that "import matlab.engine" to the first line I get the following error:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
OS: redhat
python: python.2.7.5 (not installed by anaconda)
matlab: MATLAB2018a
Python path: /usr/bin/python2.7
matlab.engine path: /usr/local/software/matlab2018/extern/engines/python/dist/matlab/engine/glnxa64/matlabengineforpython2_7.so
What I already tested:
1. Reinstalling the matlab.engine using the same python as I am compiling
2. renaming the libstdc++.so.6, so the matlab finds the system libstdc++ library
3. Adding the following line to my .bashrc file: alias matlab='LD_PRELOAD=/usr/lib64/libstdc++.so.6.0.19 /usr/local/software/matlab2018/bin/matlab -desktop'

回答(1 个)

Nagarjuna Manchineni
Ehsan, I see that you have already tried forcing a different version of libstdc++.
The issue might also occur because of the the default GCC version shipped with the operating system (eg.. Ubuntu 14.04 which is GCC 4.8.2). As of MATLAB R2018a, MATLAB external interfaces required to use GCC 6.3.* on Linux distributions . If the G++ libraries are upgraded to the required version, the dependencies will be resolved and the library can be imported into Python as normal.
Try upgrading the gcc version on your respective Linux distribution and see if all the dependencies are resolved.
Also, please note that upgrading gcc might effect other applications running on the computer.

类别

Help CenterFile Exchange 中查找有关 Call MATLAB from Python 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by