Import Error Matlab Engine in Python

조회 수: 13 (최근 30일)
Dennis Mattes
Dennis Mattes 2018년 6월 1일
댓글: Vit Kolar 2021년 12월 7일
Hello,
when I try to install the Matlab Engine in Python I receive the following error:
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/local/MATLAB/R2018a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libmwengine_api.so
I first tried to isntall it, as it is recommended on the MathWorks Website: https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
Then I also tried to use instad of
python setup.py install
This command:
python setup.py build --build-base=$(mktemp -d) install
Which also result in the same error message when I want to run the code. I use Python 3.5.2 and MATLAB R2018a with Ubuntu 16.04.
Does someone has an idea how to solve it?
Thank you very much in advance!

답변 (1개)

Han Du
Han Du 2018년 6월 4일
The issue is probably because of the the default GCC version on Ubuntu 16.04 which is GCC 5.3.1. As of MATLAB R2018a, MATLAB external interfaces required to use GCC 6.3.x 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.
Please execute the below commands on the Linux Terminal for upgrading the gcc version on Debian distributions like Ubuntu:
$ LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH
$ sudo apt-add-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc-6 g++-6
Please note that upgrading gcc might effect other applications running on the computer.
Please see the following documentation page for further reference: https://www.mathworks.com/support/compilers.html
  댓글 수: 1
Vit Kolar
Vit Kolar 2021년 12월 7일
Hello, I get OSError: Please reinstall MATLAB Engine for Python on windows installation. Any help on Win please?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by