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 CenterFile Exchange에서 Python Package Integration에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by