Unable to run mwpython

15 ビュー (過去 30 日間)
Thomas Morrell
Thomas Morrell 2021 年 11 月 11 日
コメント済み: scivision 2023 年 11 月 29 日
Hi, I recently received a Python library compiled using the MATLAB Compiler by a collaborator (in MATLAB R2021b), and am currently unable to run it. I saw that on MacOS (I'm running v12.0.1 Monterey on an M1 processor using Rosetta 2 for compatibility), a special mwpython application is needed instead of calling the system python. I installed v9.11 of the MATLAB Runtime and followed directions for adding to the DYLD_LIBRARY_PATH. When I run /<abs_path_to_app>/mwpython3.9, however, the following error message is displayed:
dyld[17284]: Library not loaded: @rpath/libpython3.9.dylib
Referenced from: /Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/mwpython3.9
Reason: tried: '/Applications/MATLAB/MATLAB_Runtime/v911/runtime/maci64/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/sys/os/maci64/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/extern/bin/maci64/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/./libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/../../../../../bin/maci64/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/../../../../../sys/os/maci64/libpython3.9.dylib' (no such file), '/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/./libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/../../../../../bin/maci64/libpython3.9.dylib' (no such file), '/Applications/MATLAB/MATLAB_Runtime/v911/bin/maci64/mwpython3.9.app/Contents/MacOS/../../../../../sys/os/maci64/libpython3.9.dylib' (no such file), '/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib' (no such file), '/usr/local/lib/libpython3.9.dylib' (no such file), '/usr/lib/libpython3.9.dylib' (no such file)
Abort trap: 6
It appears that libpython3.9.dylib was not included in the installation of the MATLAB Runtime. Is there a way to get it or work around the issue? Thanks in advance.
  1 件のコメント
scivision
scivision 2023 年 11 月 29 日
I fixed this error message by "conda deactivate" in the Terminal session I'm using. I do this each time I start a new Terminal where I want to use "mwpython".

サインインしてコメントする。

回答 (1 件)

Thomas Morrell
Thomas Morrell 2021 年 11 月 11 日
I figured it out. When the M1 processor first came out, miniforge was the preferred build environment, and I had installed Python through that. However, this installs Python in a different location than MATLAB expects. Installing Python in the standard location in x86 compatibility mode fixes the problem.
It is also worth noting that at least one Python package created via the MATLAB compiler needs to be installed before it is possible to run mwpython without error.
  1 件のコメント
Hovav Lazare
Hovav Lazare 2023 年 8 月 30 日
how do you Installing Python in the standard location in x86 compatibility mode on M1?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePython Package Integration についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by