Calysto / matlab_kernel

Jupyter Kernel for Matlab
Other
469 stars 76 forks source link

Matlab R2018b kernel couldn't work well #122

Open suixiaodan opened 5 years ago

suixiaodan commented 5 years ago

When I run the .ipynb file in the Matlab kernel, the wrong show as below: [I 11:01:21.946 NotebookApp] Kernel started: 4bc3109a-5cfc-4533-8dc3-cd02c439dfdf [I 11:01:25.909 NotebookApp] Adapting to protocol v5.1 for kernel 4bc3109a-5cfc-4533-8dc3-cd02c439dfdf [MetaKernelApp] ERROR | Exception in message handler: Traceback (most recent call last): File "/home/matlab/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 272, in dispatch_shell yield gen.maybe_future(handler(stream, idents, msg)) File "/home/matlab/.local/lib/python3.5/site-packages/tornado/gen.py", line 729, in run value = future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception File "/home/matlab/.local/lib/python3.5/site-packages/tornado/gen.py", line 209, in wrapper yielded = next(result) File "/home/matlab/.local/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 542, in execute_request user_expressions, allow_stdin, File "/usr/local/lib/python3.5/dist-packages/metakernel/_metakernel.py", line 386, in do_execute retval = self.do_execute_direct(code) File "/home/matlab/.local/lib/python3.5/site-packages/matlab_kernel/kernel.py", line 92, in do_execute_direct retval = self._execute_async(code) File "/home/matlab/.local/lib/python3.5/site-packages/matlab_kernel/kernel.py", line 250, in _execute_async future = self._matlab.eval(code, **kwargs) File "/home/matlab/.local/lib/python3.5/site-packages/matlab_kernel/kernel.py", line 68, in _matlab if self.__matlab: AttributeError: 'MatlabKernel' object has no attribute '_MatlabKernel__matlab'

What can I do?

blink1073 commented 5 years ago

Hi @suixiaodan, I think it is complaining because we check if self.__matlab is set before actually setting it. I'll push a fix.

suixiaodan commented 5 years ago

Hi @suixiaodan, I think it is complaining because we check if self.__matlab is set before actually setting it. I'll push a fix.

Thank you.

blink1073 commented 5 years ago

Please try pip install -U matlab_kernel to pick up 0.16.5.

suixiaodan commented 5 years ago

Please try pip install -U matlab_kernel to pick up 0.16.5.

I have updated to 0.16.5. But another mistake happened.

[I 11:59:33.015 NotebookApp] Creating new notebook in [W 11:59:34.045 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20190531115707 (172.27.76.20) 8.83ms referer=http://222.206.56.143:9977/notebooks/Untitled8.ipynb?kernel_name=matlab [I 11:59:34.120 NotebookApp] Kernel started: 27ff7f35-2099-438c-9bca-7398d37e89a5 [I 11:59:37.053 NotebookApp] Adapting to protocol v5.1 for kernel 27ff7f35-2099-438c-9bca-7398d37e89a5 [I 11:59:52.117 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports WARNING:root:kernel 27ff7f35-2099-438c-9bca-7398d37e89a5 restarted The kernel restarted soon. However, it didn't work.

Thanks.

blink1073 commented 5 years ago

What is the output of python -m matlab_kernel.check?

suixiaodan commented 5 years ago

What is the output of python -m matlab_kernel.check?

The output is shown as below:

`matlab@92ec2d605402:/opt/matlab/R2018b/extern/engines/python$ python -m matlab_kernel.check Matlab kernel v0.16.5 Metakernel v0.23.0 Python v3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609] Python path: /usr/bin/python

Connecting to Matlab... Matlab connection established name 'o' is not defined`

blink1073 commented 5 years ago

Drat, there was a typo in check.py, can you please run python -m pip install -U matlab_kernel and then run python -m matlab_kernel.check again?