Error Displaying FigureWidget


#1

Hi,

I am getting this error while trying out the FigureWidget. I am getting the error on both Jupyter Lab and Jupyter Notebook.

On the browser dev console:

Error displaying widget
Module plotlywidget, semver range ^0.1.1 is not registered as a widget module

Any help will be greatly appreciated as I’ve been googling and searching for an answer but to no avail.


#2

Hi @vhphan,

Did you follow all of the installation instructions in the README at https://github.com/plotly/plotly.py? There are several packages with particular versions that you need to get FigureWidget working.

-Jon


#3

Did the following (from the README). I still couldn’t make it work. :frowning:

pip install plotly==3.1.0
pip install “notebook>=5.3” “ipywidgets>=7.2”

jupyter nbextension enable --py widgetsnbextension --sys-prefix
jupyter nbextension enable --py plotlywidget --sys-prefix


#4

Hi @vhphan,

Can you double check that you have the specified versions of JupyterLab and the JupyterLab extensions installed as well?

pip install jupyterlab==0.32.1
export NODE_OPTIONS=--max-old-space-size=4096
jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.35 # install the Jupyter widgets extension
jupyter labextension install plotlywidget@0.2  # FigureWidget support
jupyter labextension install @jupyterlab/plotly-extension@0.16  # offline iplot support

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

Thanks!


#5

I have the same problem:

image

//
After installing the labextensions, still some errors appear:

Could not instantiate widget
Error: Could not create a model.
Uncaught (in promise) Module plotlywidget, semver range ^0.1.1 is not registered as a widget module
Error displaying widget

//
Result of jupyter labextension list:

JupyterLab v0.32.1
Known labextensions:
   app dir: /home/ddsadm/virtualenvs/jupyter/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager
        @jupyter-widgets/jupyterlab-manager v0.35.0  enabled  OK
@jupyterlab/plotly-extension
        @jupyterlab/plotly-extension v0.16.0  enabled  OK
ipyvolume
        ipyvolume v0.4.6  enabled  OK
jupyter-matplotlib
        jupyter-matplotlib v0.3.0  enabled  OK
plotlywidget
        plotlywidget v0.2.0  enabled  OK

//
Referring pip list outputs:

ipywidgets               7.2.1
jupyter                  1.0.0
jupyter-client           5.2.3
jupyter-console          5.2.0
jupyter-core             4.4.0
jupyterlab               0.32.1
jupyterlab-launcher      0.10.5
notebook                 5.4.0
plotly                   3.0.2

Any ideas? :slight_smile:


#6

Hi @komeyer,

It looks like you’re version of plotly (python) and plotlywidget (JupyterLab) are out of sync. Upgrade plotly.py to 3.1.0 (which corresponds to plotlywidget version 0.2.0 which you already have).

@vhphan can you check these version numbers too?

The versions numbers between the python library and the JupyterLab extensions have to line up (they are specified in the README), and unfortunately there’s not a way to enforce that the Python and JupyterLab packages do this automatically.

Thanks!


#7

Thanks a lot @jmmease , upgrading to plotly to 3.1.0 was the solution! :+1:

Just for my unterstanding: Which version numbers have to line up? Now I have:

jupyterlab 0.32.1
plotly 3.1.0
plotlywidget 0.2.0

#8

Great!

So the versions of jupyterlab (Python) and @jupyter-widgets/jupyterlab-manager (JavaScript) have to line up according to the versions listed here: https://github.com/jupyter-widgets/ipywidgets/tree/master/packages/jupyterlab-manager. This is what you need to do to get basic ipywidgets working (sliders, etc.).

For the plotly FigureWidget support you need the plotly (Python) and plotlywidget (JavaScript) versions to line up according to our README/changelog (currently 3.1.0 and 0.2.0 respectively).

The @jupyterlab/plotly-extension (JavaScript) extension is needed for offline iplot support. This shouldn’t need to be updated as frequently.

-Jon


#9

I still couldn’t make it work.

jupyter labextensions list
JupyterLab v0.32.1
Known labextensions:
app dir: c:\programdata\anaconda3\envs\data_science2\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager
@jupyter-widgets/jupyterlab-manager v0.35.0 enabled ok
plotlywidget
plotlywidget v0.2.0 enabled ok

pip list
Package Version


backcall 0.1.0
bleach 2.1.3
bokeh 0.13.0
certifi 2018.4.16
chardet 3.0.4
click 6.7
cloudpickle 0.5.3
colorama 0.3.9
colorcet 0.9.1
dask 0.18.1
datashader 0.6.6
datashape 0.5.2
decorator 4.3.0
distributed 1.22.0
entrypoints 0.2.3
HeapDict 1.0.0
html5lib 1.0.1
idna 2.7
ipykernel 4.8.2
ipython 6.4.0
ipython-genutils 0.2.0
ipywidgets 7.3.0
jedi 0.12.1
Jinja2 2.10
jsonschema 2.6.0
jupyter-client 5.2.3
jupyter-core 4.4.0
jupyterlab 0.32.1
jupyterlab-launcher 0.10.5
llvmlite 0.24.0
locket 0.2.0
MarkupSafe 1.0
mistune 0.8.3
msgpack 0.5.6
multipledispatch 0.5.0
nbconvert 5.3.1
nbformat 4.4.0
networkx 2.1
notebook 5.6.0
numba 0.39.0
numpy 1.14.5
packaging 17.1
pandas 0.23.3
pandocfilters 1.4.2
param 1.7.0
parso 0.3.1
partd 0.3.8
pickleshare 0.7.4
Pillow 5.2.0
pip 18.0
plotly 3.1.0
prometheus-client 0.3.0
prompt-toolkit 1.0.15
psutil 5.4.6
pyct 0.4.5
Pygments 2.2.0
pyparsing 2.2.0
python-dateutil 2.7.3
pytz 2018.5
PyWavelets 0.5.2
pywinpty 0.5.4
PyYAML 3.13
pyzmq 17.1.0
requests 2.19.1
retrying 1.3.3
scikit-image 0.14.0
scikit-learn 0.19.2
scipy 1.1.0
Send2Trash 1.5.0
setuptools 40.0.0
simplegeneric 0.8.1
six 1.11.0
sklearn 0.0
sortedcontainers 2.0.4
tblib 1.3.2
terminado 0.8.1
testpath 0.3.1
toolz 0.9.0
tornado 5.1
traitlets 4.3.2
urllib3 1.23
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.31.1
widgetsnbextension 3.3.0
wincertstore 0.2
xarray 0.10.8
zict 0.1.3


#10

Hi @vhphan,

If you’re still struggling with this, could you include your updated browser error message? The packages you have installed look good, but if you still have an error I’d like to see what widget version it’s complaining about.

Thanks,
-Jon


#11

Yes I’m still struggling with this. :frowning:
See the attached image.

Thanks.


#12

Hmm, ok.

A couple of thoughts. Are you able to display non-plotly ipywidgets? For example, do you see a slider when you run this code?

import ipywidgets
ipywidgets.IntSlider()

56%20AM

Another thought: I think I remember hitting a 404 error at one point (across all ipywidgets) when had a an adblock extension update. So if you have an adblock extension make sure to whitelist localhost. Also try it in multiple browsers (at least chrome and firefox), and make sure the browser versions are up to date.

Sorry, I know this is a scattershot of suggestions. Thanks for sticking with it!
-Jon


#13

Thanks for trying.

I could display non-plotly widgets.
I tried on another browser (Firefox) but still got the same errors in the browser’s console.

:frowning:


#14

Hmm, sorry I’m running out of ideas.

What I would try next is to try creating a fresh conda environment for the installation

$ conda create -n plotlywidget python=3.6
$ conda activate plotlywidget
$ pip install plotly==3.1.1
$ pip install "notebook>=5.3" "ipywidgets>=7.2"
$ pip install jupyterlab==0.33
$ export NODE_OPTIONS=--max-old-space-size=4096
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.36 --no-build
$ jupyter labextension install plotlywidget@0.2.1  --no-build
$ jupyter labextension install @jupyterlab/plotly-extension@0.16  --no-build
$ jupyter lab build
$ jupyter lab # launch and try again

-Jon