Corrupted version of Matlab Engine for python on MacOSX 10.11

조회 수: 1 (최근 30일)
Cynthia Gerlein-Safdi
Cynthia Gerlein-Safdi 2016년 5월 10일
답변: Chong Zhao 2016년 7월 28일
I used the Matlab Engine for Python a lot last fall, without any trouble. I just tried to reuse my old code today and I get the following error:
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matlab/engine/__init__.py", line 59, in <module>
raise EnvironmentError('The installation of MATLAB Engine for Python is '
EnvironmentError: The installation of MATLAB Engine for Python is corrupted. Please reinstall it or contact MathWorks Technical Support for assistance.
I am on MacOSX 10.11 (El Capitan), using Python 2.7 and Matlab 2015a. I reinstalled the Matlab Engine twice already, but no difference, I still get the same error.
Looking at the ini.py file, it seems that the line that fails is the following, yielding the error copied here:
>>> pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: dlopen(/Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython2_7.so, 2): Library not loaded: @rpath/libpython2.7.dylib
Referenced from: /Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython2_7.so
Reason: image not found
I have read a similar question where the answers pointed towards an issue with the libpython2.7.dylib HERE but I'm not sure I understand the solution. I can see the libpython2.7.dylib file in my /usr/lib/ folder.
  댓글 수: 2
Cynthia Gerlein-Safdi
Cynthia Gerlein-Safdi 2016년 5월 10일
It's looking like the re-install didn't actual replace the old files. Can I just get rid of the entire `matlab` folder in my `site-packages` folder to get a clean install?
Cynthia Gerlein-Safdi
Cynthia Gerlein-Safdi 2016년 5월 10일
I just removed the matlab folder from my site-packages folder and did a clean install of the engine. I still get the exact same error message.

댓글을 달려면 로그인하십시오.

답변 (3개)

Bo Li
Bo Li 2016년 5월 11일
The error message "Library not loaded: @rpath/libpython2.7.dylib" means that the Python library is not found or it is incompatible.
Would you try the solution that you already found?
  댓글 수: 3
Cynthia Gerlein-Safdi
Cynthia Gerlein-Safdi 2016년 5월 12일
Ok, I guess that makes sense. I'm almost certain I had already updated to 10.11 when the Engine was working last fall, but maybe I'm remembering wrong? I will try to update Matlab and see if it works. Thanks for the link!
Cynthia Gerlein-Safdi
Cynthia Gerlein-Safdi 2016년 5월 12일
Oh but wait, this table is just for Matlab in general, right? Matlab 2015a works fine on my computer right now... Why would the Engine not work if Matlab does?

댓글을 달려면 로그인하십시오.


Bo Li
Bo Li 2016년 7월 21일
What the version of Python? Python Engine from MATLAB R2015a works with CPython 2.7.12 from python.org on Mac OSX 10.11.

Chong Zhao
Chong Zhao 2016년 7월 28일
I highly suggest you to reinstall your Matlab. It works for me after I reinstall my Matlab and upgrade my python to the newest version (cause I have done these two things at the same time so I can't tell if both are needed or only one of it is needed).
Hope it works for you. :)

카테고리

Help CenterFile Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by