20

I have troubles replicating a JupyterLab install on a new PC. It is working fine on my previous one. I am unable to display simple widgets (like a checkbox from ipywidgets or ipyvuetify). I checked that jupyter-widgets is enabled with jupyter labextension list. The results is :

jupyter-vue v1.7.0 enabled ok
jupyter-vuetify v1.8.4 enabled ok
@jupyter-widgets/jupyterlab-manager v5.0.2 enabled ok (python, jupyterlab_widgets)

In the notebook, when i try to display a widget, the cell displays a Javascrip error :

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'CheckboxModel' from module '@jupyter-widgets/controls'
Error: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however, 2.0.0 is 
at f.loadClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-
manager/static/134.083e6b37f2f7b2f04b5e.js?v=083e6b37f2f7b2f04b5e:1:74976)
at f.loadModelClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab- 
manager/static/150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:10721)
at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab- 
manager/static/150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:7517)
at f.new_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab- 
manager/static/150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:5137)
at f.handle_comm_open (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab- 
manager/static/150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:3894)
at _handleCommOpen (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab- 
manager/static/134.083e6b37f2f7b2f04b5e.js?v=083e6b37f2f7b2f04b5e:1:73392)
at b._handleCommOpen (http://localhost:8888/static/lab/jlab_core.86360d749a1ef5f29afb.js? 
v=86360d749a1ef5f29afb:2:924842)
at async b._handleMessage 
(http://localhost:8888/static/lab/jlab_core.86360d749a1ef5f29afb.js? 
v=86360d749a1ef5f29afb:2:926832)
4
  • 1
    Always best if you supply more information, like the result of !python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter nbextension list && jupyter labextension list, yet I suspect you have the issue noted here & so I think you want to change your ipywidgets version to 7.7.2 or 7.6.5 to fix this issue. Check here, too. Commented Sep 14, 2022 at 16:56
  • Alternatively, this person posted code suggesting how to control some versions when using conda and so adapting some of that might help if you are using the Anaconda distribution. Commented Sep 14, 2022 at 16:58
  • 1
    Thx a lot @Wayne, I change ipywidget version to 7.7.2 and it worked Commented Sep 15, 2022 at 14:06
  • Making sure the whole environment is up to date, is enough to avoid this problem, as in this similar question: Jupyter Notebook javascript error when trying to display the widgets Commented Mar 26, 2024 at 18:09

8 Answers 8

11

That error is consistent with one noted here in an issue report recently. The suggestion there is to change to ipywidgets version 7.7.2 or 7.6.5 to fix this issue. Also, see the note here, too.

Sign up to request clarification or add additional context in comments.

1 Comment

Others have more recently found & detailed here in other answers that updating helped or using a particular version. It may have to do these days with the combination of software you have on your machine. The impetus for this original post and response was back in 2022. Also keep in mind that you probably want to do a hard refresh in your browser after changing ipywidgets. Restarting Jupyter after changing versions and then refreshing your browser window is also probably a good idea.
8

I had the same issue when my ipywidgets version is 7.6.5 After I updated ipywidgets version to 8.0.4, the problem was solved.

Comments

6

I ran into a similar error message, enabling the relevant jupyter extension and restarting the kernel solved the problem.

jupyter nbextension enable --py widgetsnbextension

You can find the detailed instructions here

1 Comment

it works, !jupyter nbextension enable --py widgetsnbextension
6

Fixed it for me:

pip install -U ipywidgets

That command changed to these versions:

    Uninstalling ipywidgets-7.6.5:
      Successfully uninstalled ipywidgets-7.6.5
Successfully installed comm-0.2.1 ipywidgets-8.1.2 jupyterlab-widgets-3.0.10 widgetsnbextension-4.0.10

1 Comment

i had to downgrade ipywidgets 8.1.3 jupyterlab-widgets 3.0.11 and widgetsnbextension 4.0.11 to the versions suggested here and now it works
5

I think the problem lies in the dependencies of libraries each other.

Below command fixed it for me

pip install -U jupyterlab ipywidgets jupyterlab-widgets

Comments

4

Sanity check: Restart Jupyter

I hate to write this... Restarting Jupyter notebook solved it for me. Just verify you have a real problem before continuing to explore.

2 Comments

Good point. I added a comment to mine suggesting a hard refresh in your browser window is probably advised, too.
Helped me as well with JupiterLab
1

I had this problem when executing a notebook on mybinder.com. The environment.yml file contained:

channels:

  • conda-forge

dependencies:

  • python=3.8.8
  • jupyter=1.0.0
  • jupyterlab=3.0.14
  • ipywidgets=7.5.1
  • matplotlib=3.4.1
  • numpy=1.20.2
  • scipy=1.6.2
  • pandas=1.2.4

Running

pip install ipympl==0.9.3

or

conda install ipympl=0.9.3

in Terminal or in Console solved the problem for me.

Comments

0

I wanted to comment under Waynes answer but I can't so here it is. I had the same problem with 8.0.6 I downgraded to 8.0.4 and then it worked!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.