Why do I get a "DLL load failed" error when importing MATLAB Engine in Python?
7 次查看(过去 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
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!