executablebooks / MyST-NB

Parse and execute ipynb files in Sphinx
https://myst-nb.readthedocs.io
BSD 3-Clause "New" or "Revised" License
200 stars 80 forks source link

Fail to evaluate notebooks when compiling Jupyter Book: no running kernel #575

Closed aritmos closed 6 months ago

aritmos commented 6 months ago

Describe the bug

Already opened an issue in the Jupyter Book repo but think it is perhaps more appropriate here. For reproducibility and environment see the original issue.

context When I try to compile a newly created jupyter book, the mystnb.eval throws an error stating that there is no running kernel for the document. I use Jupyter Labs with the myst extension. The evaluation works perfectly fine within the notebook and the kernel is always idling when trying to compile the book.

bug (?) The error stems from this branch in the code caused by element.renderer.nb_client to return a NotebookClientDirect, which to my understanding does not override the unimplemented eval_variable method from NotebookClientBase. To my understanding the only way to elide this is by handling a NotebookClientInline which does appear to implement the method. However I have only lightly glanced at the codebase so I'm not too certain on the real cause of the error.

Reproduce the bug

see original issue

List your environment

see original issue

welcome[bot] commented 6 months ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

aritmos commented 6 months ago

Issue is solved by adding

execute:
  execute_notebooks: inline

to the _config.yaml in Jupyter Book, despite this value not being in the allowed set and throwing a warning on compilation