Matlab Python Engine on MacOs
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Jinwoo Hwang
el 11 de En. de 2022
I am experiencing the exact same issue. Also cannot find any useful answers.
Walter Roberson
el 7 de Jun. de 2022
Editada: Walter Roberson
el 19 de Jun. de 2022
Respuestas (1)
Anshika Chourasia
el 25 de Feb. de 2022
Editada: Anshika Chourasia
el 25 de Feb. de 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 comentarios
Hangyu LIU
el 7 de Jun. de 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'))
Ver también
Categorías
Más información sobre Call MATLAB from Python en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!