jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

widgets not rendering on jupyter-book website (seemingly broken)

Open meldefon opened this issue 1 year ago • 11 comments

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:

Screen Shot 2023-04-06 at 5 54 12 PM

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

meldefon avatar Apr 07 '23 00:04 meldefon

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:

welcome[bot] avatar Apr 07 '23 00:04 welcome[bot]

I am experiencing the same thing on python 3.10.9 with the above jupyter-book version.

CodingKaiser avatar Apr 20 '23 20:04 CodingKaiser

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

marcdexet-cnrs avatar May 16 '23 15:05 marcdexet-cnrs

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.

marcdexet-cnrs avatar May 22 '23 08:05 marcdexet-cnrs

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.

agoose77 avatar May 22 '23 08:05 agoose77

Did this fix your problem, @marcdexet-cnrs?

agoose77 avatar May 24 '23 11:05 agoose77

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.

khliland avatar Sep 13 '23 12:09 khliland

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.

agoose77 avatar Sep 13 '23 13:09 agoose77

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?

matthew-brett avatar Oct 29 '23 14:10 matthew-brett

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!

agoose77 avatar Oct 29 '23 21:10 agoose77

Are there any updates on this?

yanivyacoby avatar Jul 25 '24 13:07 yanivyacoby