mathworks / jupyter-matlab-proxy

MATLAB Integration for Jupyter enables you to run MATLAB code in Jupyter Notebooks and other Jupyter environments. You can also open MATLAB in a browser directly from your Jupyter environment to use more MATLAB features.
Other
283 stars 36 forks source link

MATLAB Kernel Error #47

Closed christian-7 closed 1 year ago

christian-7 commented 1 year ago

Hi,

I have installed the package (Matlab 2020b, osx ventura) and can open MatLab from Jupyter lab. However, when I execute the demo

peaks

I receive the following error:

MATLAB Kernel Error: Argument # 1: image expected

It seems I can execute Matlab commands, but can not show figures. I'd appreciate any suggestions.

Christian

prabhakk-mw commented 1 year ago

@rashedmyt, could you narrow down where this error message is originating from? It seems like it's coming from https://github.com/mathworks/jupyter-matlab-proxy/blob/45c01444ed97195e26c2df83ca70024ad6f40de7/src/jupyter_matlab_kernel/matlab/processJupyterKernelRequest.m#L60 ?

rashedmyt commented 1 year ago

Hi @christian-7

We have recently updated the package to give more information when the MATLAB Kernel Error occurs. This change was released as part of v0.7.0 of jupyter-matlab-proxy

If you are able to reproduce the issue consistently, can you update the jupyter-matlab-proxy package to the latest version by using the following command pip install -U jupyter-matlab-proxy. Then reproduce the issue and post the error output here so that we can identify the cause of the issue.

prabhakk-mw commented 1 year ago

@christian-7 I'm closing this issue, as we haven't heard from you in a while. Kindly leave a comment on this issue with the information requested, and we'd be happy to continue to assist you.

Thank you!

christian-7 commented 1 year ago

Hi @prabhakk-mw thanks and sorry I missed your previous post. I have updated the package and reproduced the issue. Below I pasted the error message. I can use Matlab in jupyter lab but can not produce figures.

MATLAB Kernel Error: Error using split (line 49) Argument # 1: image expected

Error in jupyter.execute>processFigure (line 248) base64DataSplit = split(base64Data,";");

Error in jupyter.execute>processOutputs (line 142) result{idx} = processFigure(outputData.figureImage);

Error in jupyter.execute (line 54) result = processOutputs(resp.outputs);

Error in processJupyterKernelRequest (line 54) output = jupyter.execute(code, kernelId);

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON`

rashedmyt commented 1 year ago

Thank you for providing the complete error message. It looks like the error occurs in the function split at line 49 where it is expecting an image. However, the function split shipped with MATLAB in R2020b have comments at line 49.

I believe this might be a PATH management issue where another function named split is being called instead of the one which was shipped with MATLAB. Can you paste the output of which -all split. This will list all the available functions named split. In the displayed list, I would ideally expect <MATLAB Root>/toolbox/matlab/strfun/split.m to be on the top.

christian-7 commented 1 year ago

There are indeed multiple split instances:

/Applications/dip/common/dipimage/split.m
split is a built-in method                                                                           % Shadowed string method
split is a Java method                                                                               % Shadowed java.lang.String method
/Applications/MATLAB_R2020b.app/toolbox/matlab/bigdata/@tall/split.m                                 % Shadowed tall method
/Applications/MATLAB_R2020b.app/toolbox/matlab/datatypes/calendarDuration/@calendarDuration/split.m  % Shadowed calendarDuration method
/Applications/MATLAB_R2020b.app/toolbox/matlab/strfun/split.m                                        % Shadowed 

Is there a way to prioritize in one?

prabhakk-mw commented 1 year ago

Thank you for providing that information @christian-7 ! We will fix this on our end. The fix should be available in the next release of the package.

prabhakk-mw commented 1 year ago

@christian-7 this should be fixed in v0.7.2 of the jupyter-matlab-proxy package. Please update your package using

python -m pip --upgrade jupyter-matlab-proxy

Kindly let us know if this version fixes the reported issue.