Ipywidgets: 'Error displaying widget' on jupyterlab using jupyterhub

Created on 24 Jul 2019  路  23Comments  路  Source: jupyter-widgets/ipywidgets

I am getting the "Error displaying widget" error as shown in screenshot below.

Screen Shot 2019-07-23 at 5 36 27 PM

The error in chrome Javascript console is as shown below.

Screen Shot 2019-07-23 at 5 37 37 PM

I am using jupyterhub and I manually replaced the word 'tree' with 'lab' to get Jupyterlab UI. I don't see this error on tree notebook UI (only see it in lab UI). I have also installed widgetsnbextension and enabled them as shown in screenshot below.
Screen Shot 2019-07-23 at 5 43 44 PM

I have no clue why it's occurring. Is there something that I am missing here? Or Is it a real issue on Jupyterlab?

resolved-locked

Most helpful comment

I figured out, this was occurring for me with ipywidgets 7.5 only (The issue occurred irrespective of JL version, I tried both 1.0.0 and 0.35.4). The labextensions versions are as shown below.

Screen Shot 2019-07-25 at 4 01 07 PM

Everything worked fine with ipywidgets 7.4.2 and widgetsnbextension 3.4.2.

All 23 comments

widgetsnbextension is for the classic notebook. For JupyterLab, you'd need to install the @jupyter-widgets/jupyterlab-manager jlab extension: https://ipywidgets.readthedocs.io/en/stable/user_install.html#installing-the-jupyterlab-extension

I did that and I still face the same issue. I am getting these warnings when I run the command jupyter labextension install @jupyter-widgets/jupyterlab-manager

Screen Shot 2019-07-24 at 12 42 04 PM

What is the output of jupyter labextension list? It looks like you have an old version of @jupyter-widgets/jupyterlab-sidecar that is causing issues - perhaps uninstall that?

Also, what version of jupyterlab do you have? Can you upgrade to jlab 1.0?

What is the output of jupyter labextension list? It looks like you have an old version of @jupyter-widgets/jupyterlab-sidecar that is causing issues - perhaps uninstall that?

The output is as shown in screenshot after I uninstalled sidecar, but still no luck.
Screen Shot 2019-07-24 at 2 14 26 PM

I think this is an issue with older versions of lab not deduplicating @jupyter-widgets/base properly (both v1 and v2 gets pulled in, but only v2 gets registered by the manager).

Xref https://github.com/jupyter-widgets/pythreejs/issues/268 and https://github.com/jupyterlab/jupyterlab/pull/5775.

I figured out, this was occurring for me with ipywidgets 7.5 only (The issue occurred irrespective of JL version, I tried both 1.0.0 and 0.35.4). The labextensions versions are as shown below.

Screen Shot 2019-07-25 at 4 01 07 PM

Everything worked fine with ipywidgets 7.4.2 and widgetsnbextension 3.4.2.

I think this is an issue with older versions of lab not deduplicating @jupyter-widgets/base properly (both v1 and v2 gets pulled in, but only v2 gets registered by the manager).

Xref jupyter-widgets/pythreejs#268 and jupyterlab/jupyterlab#5775.

The issue occured for me even with JL 1.0.0 when I used ipywidgets 7.5.0

I would suggest:

  1. uninstalling all jlab extensions
  2. making sure you are running jlab 1.0
  3. installing just the ipywidgets extension

Make sure that works first.

Then gradually install other extensions.

I guess most of the extensions have not updated for lab 1.0 and ipywidgets 7.5 yet.

A similar issue is here: https://github.com/jupyter-widgets/ipywidgets/issues/2483#issuecomment-508640460

I and others in https://github.com/pyvista/pyvista/issues/332 are getting this same error but on local instances of Jupyter lab (no hub)

Any updates?

I and others in pyvista/pyvista#332 are getting this same error but on local instances of Jupyter lab (no hub)

Any updates?

I was able to make the widgets work using ipywidgets version 7.4.2. I faced various issues when using ipywidgets 7.5.

I was able to make the widgets work using ipywidgets version 7.4.2

That hasn't worked for me 馃槥

I and others in pyvista/pyvista#332 are getting this same error but on local instances of Jupyter lab (no hub)
Any updates?

I was able to make the widgets work using ipywidgets version 7.4.2. I faced various issues when using ipywidgets 7.5.

Did you rebuild JupyterLab? Also don't forget to restart the kernel and refresh the web page.

I closed out of all Jupyter lab environments and ran jupyter-lab build, relaunched jupyter lab, and still have the issue.

I closed out of all Jupyter lab environments and ran jupyter-lab build, relaunched jupyter lab, and still have the issue.

At this point, I am not sure what actually is causing this issue. I would suggest you try @jasongrout approach here https://github.com/jupyter-widgets/ipywidgets/issues/2514#issuecomment-515234550 to know what exactly is causing this issue.

I am facing the same issue. I built a Docker container to run Jupyterhub and the output of my jlab is:

$ jupyter lab --version
1.0.5

$ jupyter labextension list
JupyterLab v1.0.5
Known labextensions:
app dir: /usr/local/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v1.0.2 enabled OK
bqplot v0.5.0-alpha.2 enabled OK
ipyupload v0.1.3 enabled OK
jupyter-threejs v2.1.1 enabled OK
jupyterlab-datawidgets v6.2.0 enabled OK
jupyterlab-jupytext v1.0.2 enabled OK

I have this in my Docker file:

FROM python:3.7
...
RUN pip3 install jupyterhub ipywidgets jupyterlab
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager
RUN jupyter labextension install @jupyterlab/hub-extension
...

And when I try to display a button in a notebook, I get:

Error displaying widget: model not found

with this in the browser debug console:

bootstrap:149 GET http://192.168.8.250:8000/user/acelere/nullnbextensions/ipyupload/vendors~@jupyter-widgets/controls.a4c8f675a2fa65020213.js net::ERR_ABORTED 404 (Not Found)
requireEnsure @ bootstrap:149
(anonymous) @ plugin.js:159
exports @ plugin.js:158
loadClass @ manager.js:255
(anonymous) @ manager-base.js:263
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase._make_model @ manager-base.js:257
(anonymous) @ manager-base.js:246
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase.new_model @ manager-base.js:232
push.hs2k.ManagerBase.handle_comm_open @ manager-base.js:144
WidgetManager._handleCommOpen @ manager.js:59
_handleCommOpen @ default.js:967
async function (async)
_handleCommOpen @ default.js:966
_handleMessage @ default.js:1072
async function (async)
_handleMessage @ default.js:1039
(anonymous) @ default.js:122
Promise.then (async)
DefaultKernel._onWSMessage @ default.js:119
manager-base.js:273 Could not instantiate widget
(anonymous) @ manager-base.js:273
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
rejected @ manager-base.js:17
Promise.then (async)
step @ manager-base.js:18
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase._make_model @ manager-base.js:257
(anonymous) @ manager-base.js:246
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
...

I finally figured out what I was doing wrong: I use jupyterhub to spawn docker containers and after doing a docker build, I never removed the old spawned containers and they had different versions of the widgets, generating the failure. After I did a docker rm $(docker ps -aq) and restarted juptyerhub, the widgets came back to life.
Sorry for posting an issue that was not really an issue.

Thanks. It seems like @moki298 (the OP) has resolved their issue. A number of people have also chimed in with (possibly separate?) issues. Is there anyone else here that is still stuck?

Should anyone else find themselves suffering from "Error displaying widget", what eventually worked for me was uninstalling and reinstalling jupyter and jupyterlab using pip. Not the most elegant of solutions, but as downgrading ipywidgets and many other approaches didn't work, an uninstall and clean install using pip worked. I'm guessing a package or component in juptyer install was out of date.

@banesullivan was able to do it with conda, so that's another way to go as well.

I am facing the same issue in both conda and pip.
The widgets work for me, but when I run fig = ipv.figure(), console.log returns some error messages. I tried python 3.6.5 and 3.7.
all Error: https://github.com/lmielke/test_ipyvolume/blob/master/README.md
jpnb: https://github.com/lmielke/test_ipyvolume/blob/master/error.png
install: https://github.com/lmielke/test_ipyvolume/blob/master/conda_env_with_jupyter_ipyvolume.ps1

error
Would be great, if you could help. Is there a most recent working install?

Ok, using jupyter notebook instead of jupyter lab solved it for me.

Ok, using jupyter notebook instead of jupyter lab solved it for me.

This also works for me, but I have to get it working on Jupyter Lab.

I was able to make the widgets work using ipywidgets version 7.4.2

This doesn't work for me.

I've cleaned my environment and started from scratch with conda and didn't work.
Can create a new issue with extensive logs, if desired!

Was this page helpful?
0 / 5 - 0 ratings