Install Matlab engine for Python on MacBook M1

120 views (last 30 days)
Hello guys,
I tried to install Matlab engine for Python on Macbook M1.
But when I try to import matlab.engine, I met some errors.
Anyone know how to fix this error?
Thank you in advance.
import matlab.engine
dlopen(/Applications/, 0x0002):
tried: '/Applications/'
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')),
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
Hangyu LIU
Hangyu LIU on 6 Jul 2022
我用的m1适配的MATLAB. 然后我是用的这个方法,最后是能运行了。你可以试试,看能不能行
Python 安装matlab
1.install python 3.8 under -x86_64
arch -x86_64 /bin/bash -c "$(curl -fsSL"
alias ibrew="arch -x86_64 /usr/local/bin/brew"
ibrew install python@3.8
2. Open Matlab:
cd (fullfile(matlabroot,'extern','engines','python'))
system('/usr/local/opt/python@3.8/bin/python3.8 install')
3. Open VS code:
Set python interpreter: /usr/local/opt/python@3.8/bin/python3.8

Sign in to comment.

Answers (2)

Shivam Lahoti
Shivam Lahoti on 3 Jul 2022
This answer was flagged by L Dahal
You might be missing some steps in the process. you shall refer to this article and try again.

Steven Lord
Steven Lord on 3 Jul 2022
If you are using the MATLAB R2022a Native Apple Silicon Platform Open Beta, one of the limitations listed on that page is "MATLAB Engine API for Python is not available."




Community Treasure Hunt

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

Start Hunting!