Why do I get a "DLL load failed" error when importing MATLAB Engine in Python?
조회 수: 7 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2019년 12월 19일
편집: Lama Moualla
2023년 5월 17일
Why do I get a "DLL load failed" error when importing MATLAB Engine in Python? I installed the supported version of Python 2.7 and get the following error when trying to execute the command "> import matlab.engine":
trying C:\Python27\lib\site-packages\matlabengineforpython2_7.pyd
# trying C:\Python27\lib\site-packages\matlabengineforpython2_7.py
# trying C:\Python27\lib\site-packages\matlabengineforpython2_7.pyw
# trying C:\Python27\lib\site-packages\matlabengineforpython2_7.pyc
# trying C:\Python27\lib\site-packages\matlab\matlabengineforpython2_7.pyd
# trying C:\Python27\lib\site-packages\matlab\matlabengineforpython2_7.py
# trying C:\Python27\lib\site-packages\matlab\matlabengineforpython2_7.pyw
# trying C:\Python27\lib\site-packages\matlab\matlabengineforpython2_7.pyc
# trying C:\Program Files\MATLAB\R2017b\extern\engines\python\dist\matlab\engine\win64\matlabengineforpython2_7.pyd
# clear[1] _module_folder
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\matlab\engine\__init__.py", line 62, in <module>
'MathWorks Technical Support for assistance: %s' % e)
EnvironmentError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
채택된 답변
MathWorks Support Team
2020년 1월 20일
The issue is related to library conflict. For example, a custom version of "tbb.dll" is loaded, while Python Engine only works with the version shipped with MATLAB.
From the Process Monitor logs, we can find that "tbb.dll" and "tbbmalloc.dll" are loaded from "c:\Windows\System32" folder.
Renaming the files "tbb.dll" and "tbbmalloc.dll" from "c:\Windows\System32" folder will resolve the issue.
댓글 수: 1
Lama Moualla
2023년 5월 17일
편집: Lama Moualla
2023년 5월 17일
Hello
Thanks for your help.
I am trying to integrate a matlab code in ArcGIS Pro and I keep recieving a similar error.
In my case, I guess the confilct of the library is between its location in ArcGIS Pro and Matlab.
I could import matlab and matlab.engine from Spyder but I could not do it from ArcGIS Pro.
From ArcGIS Pro I am able to import matlab but not matlab.engine.
The exact error message is: DLL load failed while importing matlabengineforpython3-9. The specified procedure could not be found.
The problem is that I do not know where are the tbb.dll and tbbmalloc.dll files that I should rename them in ArcGIS system. I am afraid to mess with the wrong files.
Any help would be appreciated!
Thanks a lot
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!