ipywidgets not working after changing kernel
See original GitHub issueEnvironment 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:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😃@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.