ImportError: Matlab Engine Not Installed

First, I have tried to use Livescript on good intentions.
Second, but Livescript does not have code folding capability.
Third, thus I want to try Matlab on Jupyter notebook on WIndows 10.
Fourth, I followed
to install the python engine.
Fifth, I installed Python and Jupyter notebook.Jupyter notebook work with Python.
Sixth, I set up Matlab on Python
Seventh, I tried to import matlab engine on Python
>>> import matlab.engine
>>> eng = matlab.engine.start_matlab()
>>>
Eighth, I open "Matlab" from Jupyter
Ninth, then I tried to run 1+1 but it does not. It gives an error message of
[MetaKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "C:\Users\(..)\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 268, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "C:\Users\(..)\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\(..)\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\(..)\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 541, in execute_request
user_expressions, allow_stdin,
File "C:\Users\(..)\anaconda3\lib\site-packages\metakernel\_metakernel.py", line 395, in do_execute
retval = self.do_execute_direct(code)
File "C:\Users\(..)\anaconda3\lib\site-packages\matlab_kernel\kernel.py", line 101, in do_execute_direct
retval = self._execute_sync(code)
File "C:\Users\(..)\anaconda3\lib\site-packages\matlab_kernel\kernel.py", line 270, in _execute_sync
self._matlab.eval(code, nargout=0, stdout=out, stderr=err)
File "C:\Users\(..)\anaconda3\lib\site-packages\matlab_kernel\kernel.py", line 81, in _matlab
""")
ImportError:
Matlab engine not installed:
See https://www.mathworks.com/help/matlab/matlab-engine-for-python.htm
Please advise the next step.

댓글 수: 4

Randall Janka
Randall Janka 2020년 9월 15일
I have the same issue. Can anyone help? TIA!
leo Huang
leo Huang 2020년 9월 21일
same issues here.
Deepak Meena
Deepak Meena 2021년 6월 28일
Hi , you seems to have done all the steps corretly . Only thing that I can think of is you might have two different python versions in your system. You might have integrated the matlab enigne with the wrong python version. Let me know if this is the case.
YE ZHIXIAO
YE ZHIXIAO 2022년 10월 9일
@Deepak Meena Hi! Yes, I think it is this causation exactly. I encountered the same problem. So, may I ask what should I do to solve this problem "Matlab engine not installed"? I indeed installed it, but failed to start it in macos conda env or use it in jupyter. thanks for your time!

댓글을 달려면 로그인하십시오.

답변 (1개)

Heidi M
Heidi M 2020년 11월 25일

0 개 추천

Hello. I had the same error, and I'm using Linux. I also prefer to use Pipenv. The problem was that matlab was not in my virtual environment. So, I copied the folder into the virtualenv using the following commands:
cd /usr/local/MATLAB/R2020b/extern/engines/python/build/lib
cp -r matlab ~/.local/share/virtualenvs/MY_VIRTUAL_ENV/lib/python3.6/site-packages/matlab
You can find MY_VIRTUAL_ENV by listing the virtualenvs in the ~/.local/share directory.
Previously, I edited my bash.rc to include the following line:
export PYTHONPATH="/usr/local/MATLAB/R2020b/extern/engines/python"
However, only first step mentioned above worked.

댓글 수: 1

Heidi M
Heidi M 2020년 11월 25일
Sorry- I just realized you were using Windows. Maybe copying the referenced matlab folder into site-packages works? Hopefully this helps.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Integration with Online Platforms에 대해 자세히 알아보기

태그

질문:

2020년 7월 23일

댓글:

2022년 10월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by