Matlab Python Engine on MacOs

13 vues (au cours des 30 derniers jours)
dmhd
dmhd le 20 Déc 2021
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 commentaires
Jinwoo Hwang
Jinwoo Hwang le 11 Jan 2022
I am experiencing the exact same issue. Also cannot find any useful answers.

Connectez-vous pour commenter.

Réponses (1)

Anshika Chourasia
Anshika Chourasia le 25 Fév 2022
Modifié(e) : Anshika Chourasia le 25 Fév 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 commentaires
Hangyu LIU
Hangyu LIU le 7 Juin 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 le 19 Juin 2022
Same error. Need help

Connectez-vous pour commenter.

Catégories

En savoir plus sur Call MATLAB from Python dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by