jupyter-book
jupyter-book copied to clipboard
widgets not rendering on jupyter-book website (seemingly broken)
Describe the bug
The widget demo on the jupyter-book ipywidgets page doesn't seem to be working. I also copied the code,
import ipywidgets as widgets
widgets.IntSlider(
value=7,
min=0,
max=10,
step=1,
description='Test:',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True,
readout_format='d'
)
and try to build a page from it myself. Within the notebook itself the slider works fine, but on the rendered page I get nothing - just like in this screenshot from the jupyter-book page:

Reproduce the bug
https://jupyterbook.org/en/stable/interactive/interactive.html#ipywidgets
List your environment
python 3.11.3
>> jupyter-book --version
Jupyter Book : 0.15.1
External ToC : 0.3.1
MyST-Parser : 0.18.1
MyST-NB : 0.17.1
Sphinx Book Theme : 1.0.1
Jupyter-Cache : 0.5.0
NbClient : 0.5.13
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:
I am experiencing the same thing on python 3.10.9 with the above jupyter-book version.
We get the same here
Jupyter Book : 0.15.1
External ToC : 0.3.1
MyST-Parser : 0.18.1
MyST-NB : 0.17.2
Sphinx Book Theme : 1.0.1
Jupyter-Cache : 0.6.1
NbClient : 0.7.4
I tried to go back to previous version of jupyter-books to make the widget appear, but none of them is Ok. @meldefon do you get a previous version working as well ? Thanks.
This sounds like a problem with the JS bundle that is used to drive ipywidgets, which is probably because you have a newer (>=8.0.0
) version of ipywidgets
. Could you report whether specifying the JS version works?
The html-manager
package needs to be compatible with the version that ipywidgets
is using. For ipywidgets<8.0.0
, that's probably 0.20.0, whilst for ipywidgets>=8.0.0
, it's currently more like 1.0.0
.
Did this fix your problem, @marcdexet-cnrs?
Does anyone have any success with this or a notion if someone is working on an update?
I have tested on my computer with ipywidgets==8.0.2
and tried forcing the use of html-manager=1.09
using the following code in my _config.yml
:
sphinx:
config:
nb_ipywidgets_js:
# Load IPywidgets bundle for embedding.
"https://cdn.jsdelivr.net/npm/@jupyter-widgets/[email protected]/dist/embed-amd.js":
"data-jupyter-widgets-cdn": "https://cdn.jsdelivr.net/npm/"
"crossorigin": "anonymous"
However, none of the interactive plots render, and there are no visible warnings as far as I can tell. As of today, https://jupyterbook.org/en/stable/interactive/interactive.html#ipywidgets still displays no plot.
I've used ipywidgets8 in my thesis: https://github.com/agoose77/phd-thesis/blob/03d6392032e0066aa14e8c3a9a99de9f04762cdd/_config.yml#L185-L193
This unfortunately pulls in the latest HTML manager, but one should really match it to the version given in ipywidgets.
I've used ipywidgets8 in my thesis: https://github.com/agoose77/phd-thesis/blob/03d6392032e0066aa14e8c3a9a99de9f04762cdd/_config.yml#L185-L193
This unfortunately pulls in the latest HTML manager, but one should really match it to the version given in ipywidgets.
Thanks for this link. We have this problem too - and I wanted to see what you'd done there. I found content/3003-software-and-infrastructure.md
- but am I right that you are doing an interactive k3d widget there, but not using ipywidgets directly? Do you have any suggestions from your experience for using e.g. ipywidgets interact
?
You're right, actually; I hadn't noticed that I don't embed widgets directly. I'll take a look at this. Please ping me after Friday if I've not gotten back to you!
Are there any updates on this?