jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.1k stars 946 forks source link

Embed doesn't work anymore? (e.g: Syncing error: no comm channel defined) #3878

Closed hainm closed 5 months ago

hainm commented 5 months ago

Hi there,

I am trying to embed nglview-js-widgets 3.1.0 in my application but getting below error: https://www.npmjs.com/package/nglview-js-widgets

image

You could try to download index.html.txt (-> index.html) and open it to see the error message index.html.txt

If I change the nglview-js-widgets version from 3.1.0 to 3.0.8 in the index.html, thing just work.

3.1.0 version works fine in the notebook and lab.

Do you have idea how to resolve this? Thanks.

hainm commented 5 months ago

Another way to reproduce is

pip install nglview==3.1.0 # ipywidgets 8, notebook 7

And in notebook

# 1st cell
import nglview as nv
view = nv.demo()
view

# 2nd cell
nv.write_html("index.html", view)
!open index.html
hai-schrodinger commented 5 months ago

Syncing error: no comm channel defined'

https://github.com/jupyter-widgets/ipywidgets/blob/b2531796d414b0970f18050d6819d932417b9953/packages/base/src/widget.ts#L478-L482

hainm commented 5 months ago

Seems like an issue with the NGL release instead: https://github.com/nglviewer/ngl/issues/1014