0

I'm trying to install the matlab.engine package for anaconda spyder on windows.

I have tried:

cd matlabroot\extern\engines\python
python setup.py install

But i get the error: could not create 'build'. Access denied. I've tried searching for answers, but I don't understand them.

Hope you can help :)

FKCN18
  • 3
  • 2

3 Answers3

0

Try open terminal (cmd.exe) as admin. And more information about the process (if you are using anaconda prompt, cmd, powershell).

André Ginklings
  • 353
  • 1
  • 11
0

For this setup, I am using Windows 10, MATLAB R2020b and Pycharm.

  1. Create new Condo environment in Pycharm (add Intepreter)

enter image description here

  1. Sanity check that the python.exe exist within the newly create env

enter image description here

  1. Add the C:\Users\author\Anaconda3\envs\integrate_matlabs in path. On the Windows Search Bar, type Edit the system environment variables Click the (1)Environment Variables.., (2) Path which is located under the section System variables, (3) Browse.. and browse to the C:\Users\author\Anaconda3\envs\integrate_matlabs.Finally click (4) OK.

enter image description here

  1. Start MATLAB and type matlabroot in the command window. Copy the path returned by matlabroot.

'C:\Program Files\MATLAB\R2020b'

enter image description here

  1. On search Bar, type Command prompt, right click, and select run as administrator

enter image description here

  1. On the command prompt, type

6a) cd C:\Program Files\MATLAB\R2020b\extern\engines\python

6c C:\Program Files\MATLAB\R2020b\extern\engines\python>python setup.py install

A long list of log will be displayed. Wait until the line

C:\Program Files\MATLAB\R2020b\extern\engines\python>

which indicate the installation is complete.

  1. Restart the MATLAB,

  2. Type pyversion() on the Matlab command window which will displayed

enter image description here

mpx
  • 3,081
  • 2
  • 26
  • 56
  • For Install Matlab engine in Anaconda Python (Linux) : https://stackoverflow.com/a/70359341/6446053 – mpx Dec 15 '21 at 06:43
0

If you have already built the matlab.engine package previously and just want to use it in another environemnt, just navigate to

matlabroot\extern\engines\python\build\lib

and copy the matlab folder into the Lib folder of your environment.

Vojtanos
  • 61
  • 3