Why do I get a "DLL load failed" error when importing MATLAB Engine in Python?

28 ビュー (過去 30 日間)
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
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
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 ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by