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

7 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 20 Jan 2020
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 commentaire
Lama Moualla
Lama Moualla le 17 Mai 2023
Modifié(e) : Lama Moualla le 17 Mai 2023
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Call MATLAB from Python dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by