Clear Filters
Clear Filters

Matlab 2023a python engine fails to start

14 views (last 30 days)
Gustavo Silva
Gustavo Silva on 21 Sep 2023
Answered: Gagan Agarwal on 25 Sep 2023
I've installed the python engine for Matlab2023a using the methods described in the documentation here
The installation messages claims success but, when I try to load the engine on a python terminal i get the following error:
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/software/anaconda/2019.03/envs/gsilva/lib/python3.10/site-packages/matlab/__init__.py", line 218, in <module>
from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
ImportError: /software/matlab/R2023a/extern/engines/python/../../../extern/bin/glnxa64/../../../sys/os/glnxa64/libstdc++.so.6: undefined symbol: __cxa_thread_atexit_impl
What should I do?

Answers (1)

Gagan Agarwal
Gagan Agarwal on 25 Sep 2023
Hi Gustavo Silva,
I understand that you are trying to run the MATLAB engine directly from the Python terminal, but this is not possible. To use 'MATLAB engine' in Python, you need to create a Python script. Inside the script, you can import and start the 'MATLAB engine' using the following commands:
import matlab.engine
eng = matlab.engine.start_matlab()
You can execute the python script, by calling it from MATLAB using the 'pyrunfile' function.
For more information regarding 'pyrunfile', please refer to the following documentation: -
I hope this helps!

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!