-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use with Quarto / NBClient / nbconvert? #48
Comments
My suspicion is that this is related to the licensing? Is there a way to settle the question of being licensed in a specific step once and for all, so that subsequently tools like Quarto can simply use the kernel? To be honest, I don't understand why you require users of the kernel to explicitly confirm the license – my locally installed copy of Matlab already has an activated license. Why can't the kernel simply ask the installed copy of Matlab whether it is licensed (in my case through a |
Hi @allefeld Thank you for trying out MATLAB Integration for Jupyter.
Can you provide an example Jupyter notebook and the command used to generate the documentation so that we are able to reproduce the issue? |
Just to try to help identify the limitation. In Quarto we are leveraging nbclient and we are executing the notebook that way Is there any limitation for this matlab kernel in that case ? |
@rashedmyt, thanks for the reply. Good to know it is not a licensing issue. In included an example document in the issue. You can reproduce the error if you copy the text in the first codeblock into a file with the extension qmd, e.g.
(for which of course Quarto needs to be installed). Quarto creates a file My understanding of what happens internally (@cderv correct me if I'm wrong):
If this description is correct, then as @cderv pointed out, the part that fails is most likely the notebook execution via NBClient. As far as I can tell, NBClient is an official part of Juypter. I.e. instead of testing with Quarto, you could directly use NBClient to reproduce the problem. From the command line it is called as
I just tried that, and with the same result. The respective notebook does not have to be created by Quarto, it can be any notebook using your kernel. notebook code
|
Maybe a note why supporting Quarto is a good idea: Quarto is the successor to RMarkdown, and in contrast to it it is not focused on R but supports arbitrary languages for which a Jupyter kernel exists. It also incorporates a lot of functionality (e.g. complete website or complete book creation from multiple documents) for which RMarkdown needed extra software. RMarkdown is the standard for publishing computational documents based on R, and Quarto is well on its way to take on the same role more generally. It is similar to |
@allefeld I think you got it all right. FYI quarto can be used on .ipynb file directly so Anyhow, as you detailed after, this is probably something with nbclient execution yes. It needs to be supported for Quarto be able to work. |
This might be relevant: jupyter/nbclient#213 |
Thank you for the response. I was able to successfully reproduce the issue. As I have mentioned, the current implementation of MATLAB Kernel expects a Jupyter server to launch the kernel. I have forwarded the use case to our development team, who will consider supporting this in a future version of the product. I'll reach out to you once this support is available. |
Just add that this also prevents the use of matlab in a multi-kernel notebook (https://github.com/vatlab/sos-matlab) |
For others encountering this problem: I have created my own Matlab kernel https://github.com/allefeld/mkernel. It does not have this problem, and therefore can be easily used with Quarto. In comparison with Calysto's |
I'm currently developing a Matlab toolbox, and I use Quarto to create documentation. Quarto can execute code in documents by interacting with a Jupyter kernel. For a preliminary version of my documentation see e.g. here.
So far I have been using the unofficial matlab_kernel which works generally okay, and with which the document linked to above has been created. However, it does have a few annoying bugs, which are unlikely to get fixed anytime soon.
So I was happy to see that now there is an official Jupyter kernel for Matlab. I installed the package, and after a bit of fiddling around, mostly related to convincing Matlab that I am a licensed user, I got it to work in Jupyter Lab.
Unfortunately, the same does not hold for a Quarto document. Processing the document
leads to
The text was updated successfully, but these errors were encountered: