what-if-tool
what-if-tool copied to clipboard
Widget doesn't display in JupyterLab
Hi,
I've followed the instructions to install as faithfully as possible, and reviewed all the relevant historical tickets, but I cannot get any widget to display in jupyterlab.
jupyter core : 4.7.1
jupyter-notebook : 6.4.0
qtconsole : 5.1.0
ipython : 7.23.1
ipykernel : 5.5.5
jupyter client : 6.1.12
jupyter lab : 3.0.16
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.3
traitlets : 5.0.5
I've run:
!jupyter nbextension install --py --symlink --sys-prefix witwidget
!jupyter nbextension enable --py --sys-prefix witwidget
both inside the notebook and at the command line level (and it displays as Validating: OK) , as well as
!pip install witwidget
!jupyter labextension install wit-widget
!jupyter labextension install @jupyter-widgets/jupyterlab-manager
The wit-widget module appears as installed and enabled in my extensions manager.
When I attempt to render the widget though, via the a.render()
call, I see this output:
utils.js:119 Error: Could not create a view for model id 2e0b5ea1098845d5937ca75fd425fcdb
at r (utils.js:119)
utils.js:119 Error: Could not create view
at r (utils.js:119)
at async u.renderModel (523.fa256ee….js:1)
523.fa256ee….js:1 Error: Module wit-widget, semver range ^0.1.0 is not registered as a widget module
at x.loadClass (523.fa256ee….js:1)
at manager-base.js:87
523.fa256ee….js:1 Uncaught (in promise) Error: Module wit-widget, semver range ^0.1.0 is not registered as a widget module
at x.loadClass (523.fa256ee….js:1)
at manager-base.js:87
utils.js:119 Error: Could not create a view for model id 5b522f21fae74e5da1201476fb54b4fc
at r (utils.js:119)
utils.js:119 Error: Could not create view
at r (utils.js:119)
at async u.renderModel (523.fa256ee….js:1)
523.fa256ee….js:1 Error: Module wit-widget, semver range ^0.1.0 is not registered as a widget module
at x.loadClass (523.fa256ee….js:1)
at manager-base.js:87
523.fa256ee….js:1 Uncaught (in promise) Error: Module wit-widget, semver range ^0.1.0 is not registered as a widget module
at x.loadClass (523.fa256ee….js:1)
at manager-base.js:87
utils.js:119 Error: Could not process update msg for model id: 2e0b5ea1098845d5937ca75fd425fcdb
at r (utils.js:119)
at async C._handleCommMsg (default.js:1061)
at async C._handleMessage (default.js:1193)
utils.js:119 Error: Could not process update msg for model id: 5b522f21fae74e5da1201476fb54b4fc
at r (utils.js:119)
at async C._handleCommMsg (default.js:1061)
at async C._handleMessage (default.js:1193)
Any assistance would be appreciated, thank you.
Thanks for the detailed bug report, @NMRobert
Are you running jupyter lab on your local machine, or is it some hosted instance somewhere?
hi @jameswex - this is hosted on my local machine. I am unable to use cloud-hosted instances (eg: colab) at my workplace. Are there any other versions or local configurations I can provide which would be of assistance in debugging this issue?
Would you be willing to try with JupyterLab version 2.x instead of 3.x? I don't believe witwidget has been tested with JupyterLab 3 at this point.
I downgraded to jupyterlab==2.3.1, and reinstalled the extensions and widget manager, but I'm still seeing the same (lack of) output and javascript errors in the console.
I was able to get witwidget working with jupyterlab==2.3.1 with the following steps:
- created new python 3 virtualenv and activated it, as a fresh test environment
- pip install jupyterlab==2.3.1 witwidget
- jupyter labextension install wit-widget
- jupyter labextension install @jupyter-widgets/jupyterlab-manager@2
- Run juypter lab and use witwidget
Notice step 4 had a version number of the jupyterlab-manager extension. According to https://www.npmjs.com/package/@jupyter-widgets/jupyterlab-manager, different versions are needed depending on the jupyterlab version. I'll update the instructions on the readme accordingly.
Let me know if these steps work for you.
I run into the same problem when trying to install the extension in my local Jupyter Notebook instance. Running the last cell of the census example gives me this error message Javascript Console:
Could not create a view for model id 8b738c3d8b7b4e0a86f8c02762bfd735
And this message in the Notebook Output Cell:
[Open Browser Console for more detailed log - Double click to close this message]
Failed to create view for 'WITView' from module 'wit-widget' with model 'DOMWidgetModel' from module '@jupyter-widgets/base'
7298/r
When I tried to install the extension with the jupyter nbextension install --py --symlink --sys-prefix witwidget
command it errors and suggests to downgrade protobuf
to 3.20.x
. I did that and then I could install witwidget
. Maybe this is part of the problem I have.
These are my installed python packages:
Package Version
--------------------------------- --------
absl-py 1.4.0
anyio 3.7.0
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
arrow 1.2.3
asttokens 2.2.1
astunparse 1.6.3
attrs 23.1.0
backcall 0.2.0
beautifulsoup4 4.12.2
bleach 6.0.0
cachetools 5.3.1
certifi 2023.5.7
cffi 1.15.1
charset-normalizer 3.1.0
comm 0.1.3
debugpy 1.6.7
decorator 5.1.1
defusedxml 0.7.1
executing 1.2.0
fastjsonschema 2.17.1
flatbuffers 23.5.26
fqdn 1.5.1
gast 0.4.0
google-api-core 2.11.0
google-api-python-client 2.88.0
google-auth 2.19.1
google-auth-httplib2 0.1.0
google-auth-oauthlib 1.0.0
google-pasta 0.2.0
googleapis-common-protos 1.59.0
grpcio 1.54.2
h5py 3.8.0
httplib2 0.22.0
idna 3.4
ipykernel 6.23.1
ipython 8.14.0
ipython-genutils 0.2.0
ipywidgets 8.0.6
isoduration 20.11.0
jax 0.4.12
jedi 0.18.2
Jinja2 3.1.2
jsonpointer 2.3
jsonschema 4.17.3
jupyter_client 8.2.0
jupyter-contrib-core 0.4.2
jupyter-contrib-nbextensions 0.7.0
jupyter_core 5.3.0
jupyter-events 0.6.3
jupyter-highlight-selected-word 0.2.0
jupyter-nbextensions-configurator 0.6.3
jupyter_server 2.6.0
jupyter_server_terminals 0.4.4
jupyterlab-pygments 0.2.2
jupyterlab-widgets 3.0.7
keras 2.12.0
libclang 16.0.0
lxml 4.9.2
Markdown 3.4.3
MarkupSafe 2.1.3
matplotlib-inline 0.1.6
mistune 2.0.5
ml-dtypes 0.2.0
nbclassic 1.0.0
nbclient 0.8.0
nbconvert 7.4.0
nbformat 5.9.0
nest-asyncio 1.5.6
notebook 6.5.4
notebook_shim 0.2.3
numpy 1.23.5
oauth2client 4.1.3
oauthlib 3.2.2
opt-einsum 3.3.0
overrides 7.3.1
packaging 23.1
pandas 2.0.2
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
pip 22.3.1
platformdirs 3.5.3
prometheus-client 0.17.0
prompt-toolkit 3.0.38
protobuf 3.20.3
psutil 5.9.5
ptyprocess 0.7.0
pure-eval 0.2.2
pyasn1 0.5.0
pyasn1-modules 0.3.0
pycparser 2.21
Pygments 2.15.1
pyparsing 3.0.9
pyrsistent 0.19.3
python-dateutil 2.8.2
python-json-logger 2.0.7
pytz 2023.3
PyYAML 6.0
pyzmq 25.1.0
requests 2.31.0
requests-oauthlib 1.3.1
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rsa 4.9
scipy 1.10.1
Send2Trash 1.8.2
setuptools 65.5.0
six 1.16.0
sniffio 1.3.0
soupsieve 2.4.1
stack-data 0.6.2
tensorboard 2.12.3
tensorboard-data-server 0.7.0
tensorflow 2.12.0
tensorflow-estimator 2.12.0
tensorflow-io-gcs-filesystem 0.32.0
termcolor 2.3.0
terminado 0.17.1
tinycss2 1.2.1
tornado 6.3.2
traitlets 5.9.0
typing_extensions 4.6.3
tzdata 2023.3
uri-template 1.2.0
uritemplate 4.1.1
urllib3 1.26.16
wcwidth 0.2.6
webcolors 1.13
webencodings 0.5.1
websocket-client 1.5.3
Werkzeug 2.3.6
wheel 0.40.0
widgetsnbextension 4.0.7
witwidget 1.8.1
wrapt 1.14.1
Do you see any mistake in my setup?
I would recommend checking out the Learning Interpretability Tool (LIT), as opposed to the What-If Tool. LIT is more full-featured and customizable, and is under active development. WIT is not actively being developed anymore.
https://github.com/PAIR-code/lit/