Matlab Python Engine on MacOs

조회 수: 11 (최근 30일)
dmhd
dmhd 2021년 12월 20일
편집: Walter Roberson 2022년 6월 19일
I am trying to install the Matlab Python API on a MacOS Monterey 12.0.1 machine.
After I performed the "python3 setup.py install" command, which executes correctly, the package is in the correct site-package folder. When I start a session with "python3" and try to "import matlab.engine", I get the following error message:
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/lib/python3.9/site-packages/matlab/engine/__init__.py", line 77, in <module>
raise EnvironmentError(secondExceptionMessage)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance:
First issue: No module named 'matlabengineforpython3_9'
Second issue: dlopen(/Applications/MATLAB_R2021b.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython3_9.so, 0x0002): tried: '/Applications/MATLAB_R2021b.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython3_9.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/matlabengineforpython3_9.so' (no such file), '/usr/lib/matlabengineforpython3_9.so' (no such file)
How can I solve this?
Thank you in advance!
  댓글 수: 3
Jinwoo Hwang
Jinwoo Hwang 2022년 1월 11일
I am experiencing the exact same issue. Also cannot find any useful answers.

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

답변 (1개)

Anshika Chourasia
Anshika Chourasia 2022년 2월 25일
편집: Anshika Chourasia 2022년 2월 25일
Hi,
According to my understanding, to resolve this issue please install the maci64 version of Python and use that with (maci64) MATLAB.
You should download one of the "Intel-only" installers on this page (https://www.python.org/downloads/macos/) to get "maci" versions of Python.
  댓글 수: 2
Hangyu LIU
Hangyu LIU 2022년 6월 7일
Hello Anshika,
I have tried the "Intel-only" python version, but I still have the same error as dmhd. Could you please help me?
Traceback (most recent call last):
File "/Users/lhy/Documents/python/matlab/mat_py.py", line 1, in <module>
import matlab.engine
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matlab/__init__.py", line 214, in <module>
from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
ImportError: dlopen(/Applications/MATLAB_R2022a.app/extern/engines/python/../../../extern/bin/maci64/matlabmultidimarrayforpython.cpython-39-darwin.so, 0x0002): tried: '/Applications/Python 3.9/IDLE.app/Contents/Frameworks/matlabmultidimarrayforpython.cpython-39-darwin.so' (no such file), '/Applications/MATLAB_R2022a.app/extern/engines/python/../../../extern/bin/maci64/matlabmultidimarrayforpython.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/Applications/Python 3.9/IDLE.app/Contents/Frameworks/matlabmultidimarrayforpython.cpython-39-darwin.so' (no such file), '/Applications/MATLAB_R2022a.app/extern/bin/maci64/matlabmultidimarrayforpython.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
Ashwin Krishnakumar
Ashwin Krishnakumar 2022년 6월 19일
Same error. Need help

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

카테고리

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