Error creating widget: could not find model


#1

Hi,

I’m trying to use the new plotly.py 3.0 functionality. I followed the guide here: https://github.com/plotly/plotly.py/pull/942 but I still get an error in jupyterlab:

import plotly
import plotly.graph_objs as go

f = go.FigureWidget()
f  # printing the widget will display it

gives

Error creating widget: could not find model

I’m on Window, with anaconda (and plotly 3.0.0@rc11 installed from pip).

notebook=5.5.0
ipywidgets=7.2.1
jupyterlab=0.32.1

Any suggestions for something I may have missed? I installed and enabled the widgets as described in the PR.


#2

This the javascript error I get:

Uncaught (in promise) Error: Object ‘jupyter.widget’ not found in registry
at default.js:1432
at new Promise ()
at Object.C [as loadObject] (default.js:1411)
at e._handleCommOpen (default.js:920)
at WebSocket._onWSMessage (default.js:136)
(anonymous) @ default.js:1432
C @ default.js:1411
e._handleCommOpen @ default.js:920
_onWSMessage @ default.js:136
Promise.then (async)
e._handleCommMsg @ default.js:978
_onWSMessage @ default.js:139

jupyter nbextension list gives

Known nbextensions:
config dir: C:\Users\victor.chubukov\AppData\Local\Continuum\anaconda3\etc\jupyter\nbconfig
notebook section
plotlywidget/extension enabled
- Validating: ok
jupyter-js-widgets/extension enabled
- Validating: ok
nb_conda/main enabled
- Validating: ok
tree section
nb_conda/tree enabled
- Validating: ok


#3

Hi @chubukov

Perhaps this thread will be helpful Plotly 3.0.0 FiguerWidget not working


#4

Perhaps the threads could be unified. But I’m still having issues after reading through the suggestions there.

I uninstalled and reinstalled jupyter, jupyterlab, notebook and ipywidgets. When I opened jupyterlab, it prompted me to rebuild the plotly widget. Before rebuilding, the simple example above would run, and output the figure object as a dict. After rebuilding I get exactly the same behavior as in my first post.

As a weird side effect, as soon as I build the plotly widget, my jupyterlab toolbar (with the copy cell, stop kernel, etc buttons) shrinks to an almost unusably thin size. After reinstall, it went back to normal, and then back to super-thin after I rebuild the plotly widget.


#5

Hi @chubukov,
Two days ago we released plotly.py 3.1.0 and plotlywidget 0.2.0. And we updated the README.md installation instructions with the exact versions of everything that’s needed to get FigureWidget working in JupyterLab (These include both Python and JupyterLab packages).

Can you double check that you’ve gone through these instructions and that you have the specified versions of all of these packages installed?

If things still aren’t working, please post the result of running pip list and jupyter labextension list in your environment.

Thanks!


#6

@jmmease Thanks. In a fresh conda environment, I was able to get this to work as described. I will update you if I figure out what the issue is in my working environment.