Dexter
Dexter

Reputation: 23

import error : no module named matlab.engine

I am trying to run python file wherein I need to import matlab.engine. Even after following the steps mentioned here , I still get the error "ImportError: No module named matlab.engine"

Any suggestions on how I can remove this error? I am using ubuntu 16.04.

Thanks !

Upvotes: 2

Views: 3533

Answers (2)

Aether
Aether

Reputation: 85

Here's an updated answer to this question for those using an Anaconda Python distribution (e.g., Python 3.6.8 works) with PyCharm IDE on Windows 10:

If Dando Mando Nogger's answer from July 2017 doesn't work, try deleting -d option. Specifically:

python setup.py build --build-base=$(mktemp) install

If above command fails (or does nothing), try running it from PyCharm terminal instead of from Anaconda Cmd Prompt (you may need to run PyCharm as administrator).

If above command runs successfully, but you still face problems, try the following command in Python console to confirm that your Anaconda site-packages directory is included in your Python system path:

print(sys.path)

After executing above command, if you don't see a ...\site-packages\ ... folder anywhere in a listing of your Python system path, then try following steps from Python console:

import sys
sys.path.append(r'full path\to\your\Anaconda\Lib\site-packages directory')

Finally, to see if any of the above has helped, try to run:

import matlab.engine
eng = matlab.engine.start_matlab()

If you get: Process finished with exit code 0, then you're probably good to go.

Upvotes: 0

Dando Mando Nogger
Dando Mando Nogger

Reputation: 157

Try doing python setup.py build --build-base=$(mktemp -d) install

Upvotes: 2

Related Questions