Matlab Python Engine on MacOs

13 visualizzazioni (ultimi 30 giorni)
dmhd
dmhd il 20 Dic 2021
Modificato: Walter Roberson il 19 Giu 2022
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 Commenti
Jinwoo Hwang
Jinwoo Hwang il 11 Gen 2022
I am experiencing the exact same issue. Also cannot find any useful answers.

Accedi per commentare.

Risposte (1)

Anshika Chourasia
Anshika Chourasia il 25 Feb 2022
Modificato: Anshika Chourasia il 25 Feb 2022
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 Commenti
Hangyu LIU
Hangyu LIU il 7 Giu 2022
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 il 19 Giu 2022
Same error. Need help

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by