question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ipywidgets not working after changing kernel

See original GitHub issue

Environment data

  • VS Code version: 1.61.2
  • Jupyter Extension version (available under the Extensions sidebar): main branch
  • Python Extension version (available under the Extensions sidebar): v2021.10.1365161279
  • OS (Windows | Mac | Linux distro) and version: macOS 10.15.7
  • Python and/or Anaconda version: 3.9
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Jupyter server running: Local

Expected behaviour

After changing kernel, cells with ipywidgets can be re-run to show the widgets.

Actual behaviour

After changing the kernel, ipywidgets stops working.

Steps to reproduce:

Given a notebook containing a single cell with this code:

import ipywidgets as w
w.IntSlider()

If you run it, it will show a widget. If you now change kernel, then change back to the original kernel, and then run it again it will no longer show a widget. If you close the notebook and re-open it, it will work.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zpincuscommented, Nov 5, 2021

Sorry for not noting this above, but I can confirm that on v2021.10.1001414422 of the Jupyter extension, not only does ipywidgets work when changing kernels on the local server (which starts a new kernel every time), but it also works on remote servers when starting up new kernels. It’s only broken when connecting to an existing kernel on remote servers, so this is definitely progress 😃

1reaction
DonJayamannecommented, Nov 5, 2021

@zpincus I’ve created an issue here https://github.com/microsoft/vscode-jupyter/issues/8179 Please could you confirm this works for local kernels, that way we can close this issue and track the work for remote kernels on #8179 and we’ll try to get that fixed in a recovery build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IPython Notebook ipywidgets does not show - Stack Overflow
So the best way is to do jupyter notebook <notebook name> , which will open notebook on chrome, and then change the kernel...
Read more >
Widget Events — Jupyter Widgets 7.7.0 documentation
If two sliders are linked in the kernel, when one slider is changed the browser sends a message to the kernel (python in...
Read more >
Installation — Jupyter Widgets 7.6.5 documentation
Install the widgetsnbextension package in the environment containing the Jupyter Notebook server. Install ipywidgets in each kernel's environment that will use ...
Read more >
ipywidgets changelog — Jupyter Widgets 7.7.2 documentation
A summary of changes in ipywidgets. For more detailed information, see the issues and pull requests for the appropriate milestone on GitHub.
Read more >
Asynchronous Widgets — Jupyter Widgets 7.7.2 documentation
Typically this would be hard to do since running Python code blocks any ... units of work, and pause after each one until...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found