The issue is due to loading one of the libraries MATLAB Engine needs from the wrong location. Python is loading "tbb.dll" and/or "tbbmalloc.dll" from the system folder "C:\Windows\System32" instead of loading them from "<matlabroot>/bin/win64".
As a workaround, rename these files in the system folder so that Python can no longer find them. Other workarounds include:
1) Copying the MathWorks version of the DLL to the same folder as the Python executable (not into a subfolder), and leave the "System32" version as it originally was.
2) Place the MathWorks version of the DLL into "System32" (after copying or renaming the original so it does not get overwritten). This may allow all applications to use the same version of "tbb.dll", but there is a chance that it will not compatible.
3) Determine what application or applications might be using the "tbb.dll" file that is located in "C:\Windows\System32" and copy that version to the same folder as those application executables. Then remove the DLL from "System32" entirely. A tool called Process Explorer can help by showing which DLLs have been loaded by a particular open application. However, this would require opening any application which might have put the library into the "System32" directory, which may be a time-consuming process. For more information on Process Explorer, please refer to the following page:
Which one work best will depend on your workflow and use case.
Best Answer