Corrupted installation of MATLAB Engine for Python
    22 views (last 30 days)
  
       Show older comments
    
I'm trying to install the MATLAB Engine for Python on Windows 7.
When I run "python setup.py install" in the python engine directory the engine seems to build and install fine. But, when I try to import matlab.engine in Python I receive this error:
"EnvironmentError: The installation of MATLAB Engine for Python is corrupted. Please reinstall it or contact MathWorks technical Support for assistance."
I have tried reinstalling the engine to no avail. I'm using 64-bit MATLAB and 64-bit Python. Has anyone had a similar issue?
1 Comment
  haojing
 on 17 Feb 2016
				Hi Ross, Have you solved this problem? I am encountering exactly the same problem and I couldn't find a way to solve it.
The matlab engine used to work correctly but after I did a os upgrade it started to report such error. I've tried to reinstall the matlab engine but got no luck...
Answers (5)
  Bo Li
    
 on 31 Mar 2015
        Would you try the verbose mode of Python?
C:\>python -vvv
>>>import matlab.engine
The output may have some useful info.
  Nagabhushan SN
      
 on 25 Oct 2019
        If you're trying to install matlab engine in a conda environment, follow the below steps:
cd "matlabroot\extern\engines\python"
python setup.py install --prefix="installdir"
Eg
cd /Applications/MATLAB_R2015a.app/extern/engines/python
python setup.py install --prefix="/Users/user/anaconda/"
Now, matlab engine package is actually installed under the separate 
anaconda3/lib/python3.6/site-package/matlab
So you need to manually move that matlab folder to the site-package folder your python is using. If you have multiple virtual envs, move it to the corresponding site-package folder of the virtual env you will run program.
Eg
anaconda3/env/my_env/lob/python3.6/site-packages/matlab
References:
0 Comments
  Bo Li
    
 on 31 Mar 2015
        Which version of CPython are you using? Would you try both CPython 2.7 and CPython 3.3 to see how they work?
0 Comments
  Dave Bergstein
    
 on 1 Apr 2015
        This particular build of Python is not compatible with the MATLAB Engine for Python, which was developed for the reference Python implementation. Consider using one of the versions of Python described at the link below (including Python 2.7).
The link also includes requirements for building Python from source.
2 Comments
  Summer K.Rock
 on 28 Feb 2022
				
      Edited: Summer K.Rock
 on 28 Feb 2022
  
			Is there possible that copy "extern/engine/python" files to a pc without maltab installing, and use “pip install", could the APIEngine be installed?  
Is matlab really necessary before install API engine?
See Also
Categories
				Find more on Introduction to Installation and Licensing in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



