Original post/problem below.
There is currently a bug that causes the Thebelab kernel config setting (kernel_name
) to not be refreshed/changes relative to the initial page the user accessed the Jupyter Book on.
This issue was discovered (for me) because the initial landing page in the template (content/intro.md) is not an ipynb, so when the (_build/intro.md) file is built, the kernel_name
config value is not set. Due to a recent contribution, pages with no kernel_name
set in their configs start Thebelab using python3. So for me, since all my notebooks were not using the python3 kernel (I was using SoS) , every user landing on the home page first were not using the right kernel to run the Jupyter Notebooks later one when browsing the other pages. A page reload would fix this issue (if on a page that was build using an ipynb), presumably because this would clear the cache and initiate a new Thebelab session (this time, on a page that has the proper kernel_name
setup).
(original post)
I'm not sure which tool is the culprit here, so I'll start by posting my issue here at the top and work my way down.
I'm using Jupyter Book, the Thebelab feature, MyBinder, a Dockerfile, and the Jupyter Notebooks are running on the Script of Scripts kernel for multi-language support.
This issue is reproducible, I've done it several times in a row. It happens for other UX "pathways", not all, but for the sake of simplicity I will describe the simplest here.
The gist of the issue is that, the first time a user (that's me!) loads a Jupyter Book chapter, then tries to run a Thebelab cell, the magic command at the top of the cell (used/required by the Script of Scripts Jupyter kernel to indicate which language needs to be used for that cell, e.g. %use octave
, %use sos
(actually means python3)) is either not executed, not recognized, or something else. Or, the jupyter book isn't opened using the SoS kernel. This causes an error (for my case, since the first cell is some Octave/Matlab code, the an error is thrown I think because it still thinks it's in a python environment and can't read the Matlab syntax).
HOWEVER, if I simply immediately reload the web page, and follow the same steps, the kernel is loaded fine, and the cells execute without issue.
I took two videos of me reproducing this issue:
Video 1: https://www.youtube.com/watch?v=aeiB_LB2Q6w&feature=youtu.be
Video 2: https://www.youtube.com/watch?v=P0B9Zqr886Y&feature=youtu.be
Note that, I don't encounter this behaviour if I try running the cells within a separate MyBinder session (not Thebelab).
To replicate the steps exactly:
1 - Start at the landing page : https://qmrlab.org/t1_book
2 - Click the "Signal Modelling" page under "Inversion Recovery"
3 - Click the "Interact Inline" button.
4 - Go down to the first cell (starts with %use octave
), and click run
5 - (optional) Since the first cell isn't supposed to have any output and only the second one does, click run on the second cell too (starts with %use sos
)
6 - You should have encountered errors for both cells.
7 - Immediately reload the page.
8 - Follow steps 3-5, and a plotly figure should appear after the second cell after a minute or so.
Repo: https://github.com/qMRLab/t1_book
Github is setup to generate the site off of the gh-pages branch: https://github.com/qMRLab/t1_book/tree/gh-pages