Error Displaying FigureWidget

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.

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

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

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!

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:

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!

1 Like

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

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

2 Likes

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

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

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

Thanks.

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

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:

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

I had the same issue as @vhphan and the fix was, as you suggested, to strictly match versions as described in the README/Changelog (e.g. https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md#jupyterlab-versions for latest plotly 3.4.0).

1 Like

Hi, I am getting similar error as vhphan and not sure how to fix it since I thought I have matched all the versions.

here is what I have:
JupyterLab v0.35.3
Known labextensions:
app dir: C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager v0.38.1 enabled ok
@jupyterlab/plotly-extension v0.18.2 enabled ok
@jupyterlab/statusbar v0.5.0 enabled ok
@jupyterlab/toc v0.6.0 enabled ok
@jupyterlab/xkcd-extension v0.6.0 enabled ok
jupyterlab-chart-editor v1.0.0 enabled ok
jupyterlab-flake8 v0.2.4 enabled ok
jupyterlab-python-file v0.2.0 enabled ok
plotlywidget v0.8.0 enabled ok

Build recommended, please run jupyter lab build:
plotlywidget needs to be included in build
jupyterlab-chart-editor needs to be included in build
@jupyterlab/plotly-extension changed from file:…/extensions/jupyterlab-plotly-extension-0.18.1.tgz to file:…/extensions/jupyterlab-plotly-extension-0.18.2.tgz

and here is what I get from piplist:

Package Version


alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.6
anaconda-project 0.8.2
appdirs 1.4.3
asn1crypto 0.24.0
astroid 2.1.0
astropy 3.1.2
atomicwrites 1.3.0
attrs 18.2.0
Automat 0.7.0
Babel 2.6.0
backcall 0.1.0
backports.os 0.1.1
backports.shutil-get-terminal-size 1.0.0
beautifulsoup4 4.7.1
bitarray 0.8.3
bkcharts 0.2
blaze 0.11.3
bleach 3.1.0
bokeh 1.0.4
boto 2.49.0
Bottleneck 1.2.1
certifi 2019.3.9
cffi 1.12.1
chardet 3.0.4
Click 7.0
cloudpickle 0.8.0
clyent 1.2.2
colorama 0.4.1
comtypes 1.1.7
conda 4.6.8
conda-build 3.17.8
constantly 15.1.0
contextlib2 0.5.5
cryptography 2.5
cycler 0.10.0
Cython 0.29.5
cytoolz 0.9.0.1
dash 0.30.0
dash-core-components 0.38.0
dash-html-components 0.13.2
dash-renderer 0.15.0
dash-table 3.1.5
dask 1.1.3
datashape 0.5.4
decorator 4.3.2
defusedxml 0.5.0
distributed 1.26.0
docutils 0.14
entrypoints 0.3
et-xmlfile 1.0.1
fastcache 1.0.2
filelock 3.0.10
Flask 1.0.2
Flask-Compress 1.4.0
Flask-Cors 3.0.7
gevent 1.4.0
glob2 0.6
greenlet 0.4.15
h5py 2.9.0
heapdict 1.0.0
html5lib 1.0.1
hyperlink 18.0.0
idna 2.8
imageio 2.5.0
imagesize 1.1.0
importlib-metadata 0.7
incremental 17.5.0
ipykernel 5.1.0
ipython 7.3.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
isort 4.3.8
itsdangerous 1.1.0
jdcal 1.4
jedi 0.13.3
Jinja2 2.10
jsonschema 2.6.0
jupyter 1.0.0
jupyter-client 5.2.4
jupyter-console 6.0.0
jupyter-core 4.4.0
jupyterlab 0.35.3
jupyterlab-launcher 0.13.1
jupyterlab-server 0.2.0
keyring 18.0.0
kiwisolver 1.0.1
lazy-object-proxy 1.3.1
libarchive-c 2.8
llvmlite 0.27.0
locket 0.2.0
lxml 4.3.1
MarkupSafe 1.1.1
matplotlib 3.0.2
mccabe 0.6.1
menuinst 1.4.14
mistune 0.8.4
mkl-fft 1.0.10
mkl-random 1.0.2
more-itertools 5.0.0
mpmath 1.1.0
msgpack 0.6.1
multipledispatch 0.6.0
navigator-updater 0.2.1
nbconvert 5.3.1
nbformat 4.4.0
networkx 2.2
nltk 3.4
nose 1.3.7
notebook 5.7.4
numba 0.42.0
numexpr 2.6.9
numpy 1.16.2
numpydoc 0.8.0
odo 0.5.1
olefile 0.46
openpyxl 2.6.0
packaging 19.0
pandas 0.24.1
pandocfilters 1.4.2
parso 0.3.4
partd 0.3.9
path.py 11.5.0
pathlib2 2.3.3
patsy 0.5.1
pep8 1.7.1
pickleshare 0.7.5
Pillow 5.4.1
pip 19.0.3
pkginfo 1.5.0.1
plotly 3.6.1
pluggy 0.9.0
ply 3.11
prometheus-client 0.6.0
prompt-toolkit 2.0.9
psutil 5.5.0
py 1.8.0
pyasn1 0.4.5
pyasn1-modules 0.2.4
pycodestyle 2.5.0
pycosat 0.6.3
pycparser 2.19
pycrypto 2.6.1
pycurl 7.43.0.2
pyflakes 2.1.0
Pygments 2.3.1
PyHamcrest 1.9.0
pylint 2.2.2
pyodbc 4.0.26
pyOpenSSL 19.0.0
pyparsing 2.3.1
pyreadline 2.1
PySocks 1.6.8
pytest 4.3.0
pytest-arraydiff 0.3
pytest-astropy 0.5.0
pytest-doctestplus 0.2.0
pytest-openfiles 0.3.2
pytest-remotedata 0.3.1
python-dateutil 2.8.0
pytz 2018.9
PyVISA 1.9.1
PyWavelets 1.0.1
pywin32 223
pywinpty 0.5.5
PyYAML 3.13
pyzmq 18.0.0
QtAwesome 0.5.6
qtconsole 4.4.3
QtPy 1.6.0
requests 2.21.0
retrying 1.3.3
rope 0.12.0
ruamel-yaml 0.15.46
scikit-image 0.14.1
scikit-learn 0.20.2
scipy 1.2.1
seaborn 0.9.0
Send2Trash 1.5.0
service-identity 18.1.0
setuptools 40.8.0
simplegeneric 0.8.1
singledispatch 3.4.0.3
six 1.12.0
snowballstemmer 1.2.1
sortedcollections 1.1.2
sortedcontainers 2.1.0
soupsieve 1.7.1
Sphinx 1.8.4
sphinxcontrib-websupport 1.1.0
spyder 3.3.3
spyder-kernels 0.4.2
SQLAlchemy 1.2.18
statsmodels 0.9.0
sympy 1.3
tables 3.4.4
tblib 1.3.2
terminado 0.8.1
testpath 0.4.2
toolz 0.9.0
tornado 5.1.1
tqdm 4.31.1
traitlets 4.3.2
Twisted 18.9.0
unicodecsv 0.14.1
urllib3 1.24.1
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.14.1
wheel 0.33.1
widgetsnbextension 3.4.2
win-inet-pton 1.1.0
win-unicode-console 0.5
wincertstore 0.2
wrapt 1.11.1
xlrd 1.2.0
XlsxWriter 1.1.5
xlwings 0.15.3
xlwt 1.3.0
zict 0.1.3
zope.interface 4.6.0

would you advise me if my versions are compatible? I get this build issue all the time.

thanks

Hi @soha,

I think this part might be the key. What happens when you run jupyter lab build from the command line?

-Jon

here is what I get :

(base) C:\Users\snamnaba>jupyter lab build
[LabBuildApp] JupyterLab 0.35.3
[LabBuildApp] Cleaning C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\share\jupyter\lab
Cleaning C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\share\jupyter\lab…
Success!
[LabBuildApp] Building in C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\share\jupyter\lab
[LabBuildApp] Node v10.13.0

[LabBuildApp] > node C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js install
yarn install v1.9.4
info No lockfile found.
[1/5] Validating package.json…
[2/5] Resolving packages…
warning jupyterlab-chart-editor > react-chart-editor > plotly.js > mapbox-gl > @mapbox/gl-matrix@0.0.1: This
warning jupyterlab-chart-editor > react-chart-editor > plotly.js > ndarray-fill > cwise > static-module > through2 > xtend > object-keys@0.4.0:
warning css-loader > cssnano > autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
[3/5] Fetching packages…
[-------------------------------------------------------------------------------------------------------------------------------------] 0/1345(node:11204) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
error An unexpected error occurred: “https://registry.yarnpkg.com/mdi-react/-/mdi-react-3.4.0.tgz: ESOCKETTIMEDOUT”.
info If you think this is a bug, please open a bug report with the information provided in “C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\share\jupyter\lab\staging\yarn-error.log”.
info Visit https ://yarnpkg.com/en/docs/cli/install for documentation about this command.
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
[LabBuildApp] > node C:\Users\snamnaba\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js run build
yarn run v1.9.4
$ webpack
‘webpack’ is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

Hi @soha,

I looks like the problem is that the JupyterLab package manager doesn’t think it has internet access.

info There appears to be trouble with your network connection. Retrying…

Are you connected to the internet during the build process?

If so, it might also be worth trying to install nodejs using conda and then rebuilding

$ conda install nodejs
$ jupyter lab build

-Jon

yes I do have access to the internet at all times when I tried to build Jupyterlab. Though I don’t know why it always give that error. I also tried cloning my environment and rebuild jupyter lab but still faced same issue.