TsotsosLab / SMILER

The Saliency Model Implementation Library for Experimental Research.
Other
44 stars 16 forks source link

[Matlab] When installing matlab and matlab.engine #3

Closed bwijerat closed 2 years ago

bwijerat commented 5 years ago

I feel it would be valuable to provide some advice for installation and use for those unfamiliar with the matlab in linux, and the matlab.engine which is used to call matlab from python.

Using MATLAB in Ubuntu (after installation and activation):

Installing MATLAB Engine API for Python https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html

This may fail (permission problems, but then using sudo fails to properly install it too):

cd "matlabroot/extern/engines/python"
python setup.py install

This worked for me (Ubuntu 16.04 LTS, Python 2.7, 3.5, 3.6, Anaconda 4.3): https://stackoverflow.com/questions/45016671/import-error-no-module-named-matlab-engine

cd "matlabroot\extern\engines\python"
python setup.py build --build-base=$(mktemp -d) install

Test matlab.engine via commands (output: True): https://www.youtube.com/watch?v=yhnB7zWgi_Q

import matlab.engine
eng = matlab.engine.start_matlab()
tf = eng.isprime(37)
print(tf)
tkunic commented 5 years ago

Thanks for the info! Mind if I modify this a bit and add it to the repo wiki?

bwijerat commented 5 years ago

Of course, please go ahead and thanks for the quick response