To run Python commands and use Python modules in MATLAB on Apple Silicon, the MATLAB and Python builds, maci64 or maca64, must match. Here maci64 refers to an Intel x86-64 build of the software, and maca64 refers to a native Apple Silicon build of the software.
1) A maci64 version of MATLAB requires a universal build or maci64 build of the Python libraries.
- Use of maci64 MATLAB (R2020b and later) on Apple Silicon is supported through the Rosetta 2 translation layer.
- Be aware that applications must be built for Apple Silicon to take full advantage of the architecture.
- The command "arch -x86_64 python3 -m pip" allows you to install the maci64 build of a Python package with a universal build of Python. For example, to install a maci64 build of your Python package "myPythonPackage", use the following command.
arch -x64_64 python3 -m pip myPythonPackage
2) A maca64 (native) build of MATLAB requires a universal build or maca64 build of the Python libraries.
- A maca64 build of MATLAB is available for release R2022b (Beta) and release R2023b and later.
- To use the native build of maca64 MATLAB, you will need to download the “aarch64” version of Java 8 as recommended by this website.
- Note that x64 versions of Oracle Java 8 do not work with native builds of maca64 MATLAB.