Why does Python 3.6 fail to import MATLAB Engine and give a “DLL load failed” error?
I am using MATLAB R2018a. I have installed CPython 3.6.7 and installed MATLAB engine as mentioned in the documentation page obtained by running the following command on MATLAB R2018a:
web(fullfile(docroot, ‘matlab/matlab_external/install-the-matlab-engine-for-python.html’))
But I am getting the below error on executing "
import matlab.engine":
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:ProgramsPythonPython36libimportlib_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘matlabengineforpython3_6’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:ProgramsPythonPython36libsite-packag
esmatlabengine__init__.py", line 59, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSIO
N)
File "C:ProgramsPythonPython36libimportlib_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:PythonPython36libsite-packag
esmatlabengine__init__.py", line 62, in <module>
‘MathWorks Technical Support for assistance: %s’ % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
The file C:Program FilesMATLABR2018aexternenginespythondistmatlabenginewin64matlabengineforpython3_6.pyd also got created.
Please follow the below link to search for the required information regarding the current release:https://www.mathworks.com/help/I am using MATLAB R2018a. I have installed CPython 3.6.7 and installed MATLAB engine as mentioned in the documentation page obtained by running the following command on MATLAB R2018a:
web(fullfile(docroot, ‘matlab/matlab_external/install-the-matlab-engine-for-python.html’))
But I am getting the below error on executing "
import matlab.engine":
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:ProgramsPythonPython36libimportlib_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘matlabengineforpython3_6’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:ProgramsPythonPython36libsite-packag
esmatlabengine__init__.py", line 59, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSIO
N)
File "C:ProgramsPythonPython36libimportlib_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:PythonPython36libsite-packag
esmatlabengine__init__.py", line 62, in <module>
‘MathWorks Technical Support for assistance: %s’ % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
The file C:Program FilesMATLABR2018aexternenginespythondistmatlabenginewin64matlabengineforpython3_6.pyd also got created.
Please follow the below link to search for the required information regarding the current release:https://www.mathworks.com/help/ I am using MATLAB R2018a. I have installed CPython 3.6.7 and installed MATLAB engine as mentioned in the documentation page obtained by running the following command on MATLAB R2018a:
web(fullfile(docroot, ‘matlab/matlab_external/install-the-matlab-engine-for-python.html’))
But I am getting the below error on executing "
import matlab.engine":
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:ProgramsPythonPython36libimportlib_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘matlabengineforpython3_6’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:ProgramsPythonPython36libsite-packag
esmatlabengine__init__.py", line 59, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSIO
N)
File "C:ProgramsPythonPython36libimportlib_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:PythonPython36libsite-packag
esmatlabengine__init__.py", line 62, in <module>
‘MathWorks Technical Support for assistance: %s’ % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: DLL load failed: The specified procedure could not be found.
The file C:Program FilesMATLABR2018aexternenginespythondistmatlabenginewin64matlabengineforpython3_6.pyd also got created.
Please follow the below link to search for the required information regarding the current release:https://www.mathworks.com/help/ tbb, engine, api, python3 MATLAB Answers — New Questions