Immutable solution version
Fix ipywidgets that render blank or fail in JupyterLab
Complete solution
Diagnose ipywidgets that show blank output or renderer errors in JupyterLab: classify kernel-side comm failures vs frontend/backend version mismatches from the visible symptom, verify the ipywidgets/jupyterlab_widgets version pairing, and resync with upgrade plus kernel restart and browser refresh.
When it applies
[{"constraint": "8.x with jupyterlabwidgets 3.x on JupyterLab 3.x/4.x, or 7.x with jupyterlab-manager 2.x on JupyterLab 2.x", "technology": "ipywidgets", "versionscheme": "semver"}, {"constraint": ">=2.0", "technology": "JupyterLab", "version_scheme": "semver"}]
Fix ipywidgets that render blank or fail in JupyterLab
Use this when a cell creating a widget (e.g. widgets.IntSlider(), tqdm notebook bars, plotly figures rendered through ipywidgets) shows blank output, an error box, or nothing at all. A widget has two halves — Python code in the kernel and a JavaScript renderer in the browser — and the failure tells you which half is broken. Classify first from the visible symptom, then fix that half.
1. Classify the failure from the visible symptom
A. The output area shows an error box mentioning the widget renderer, or the browser console shows Could not open comm / Control comm was closed too early: the kernel side failed. The widget's communication channel never opened or died — usually the kernel was restarted after the widget was created, or the running kernel doesn't have ipywidgets installed at all.
B. The browser console shows Cannot find model module @jupyter-widgets/controls (or a similar module-not-found message): a frontend/backend version mismatch. The Python ipywidgets in the kernel and the JupyterLab extension rendering it disagree.
C. No error anywhere, just blank output: usually B in disguise (mismatched versions fail silently) or the rendering extension is missing entirely. Check both halves anyway (steps 2 and 3).
2. Check the kernel half
From a cell in the running notebook:
import ipywidgets
print(ipywidgets.__version__)ImportError/ModuleNotFoundError: ipywidgets is not installed in the kernel's environment. Install it into that environment (use the%pipmagic inside a cell so it lands in the kernel's env, not the server's) and restart the kernel.Control comm was closed too earlyright after a kernel restart is expected: widget state lives in the kernel process, so outputs created before the restart cannot be revived. Re-run the cells that created the widgets; the old output areas will stay dead.
3. Check the browser half
jupyter labextension listLook for a line like @jupyter-widgets/jupyterlab-manager v5.x.x enabled OK. The version pairing that works (verified against the packages' own metadata):
ipywidgets 8.x requires
jupyterlab_widgets~=3.0andwidgetsnbextension~=4.0(both pulled in automatically bypip install ipywidgets), and works with JupyterLab 3.x and 4.x. Per the jupyterlab-widgets README: "To enable ipywidgets support in JupyterLab 3.x or 4.x:pip install jupyterlab_widgets".ipywidgets 7.x pairs with JupyterLab 2.x via
jupyter labextension install @jupyter-widgets/jupyterlab-manager@2. Prebuilt (pip-installable) widget extensions arrived with JupyterLab 3; older Labs need the manuallabextension installwith the matching major version.
If the manager line is missing, disabled, or its major version doesn't match the Python ipywidgets major version, the browser half is broken.
4. Fix: resync the two halves, then restart and refresh
pip install --upgrade ipywidgets jupyterlab_widgets
# conda users: conda install -c conda-forge ipywidgets jupyterlab_widgetsThen do both of these — one without the other leaves the bug in place:
- Restart the kernel and re-run the widget cells (new Python widget state).
Hard-refresh the browser page (or open a fresh tab). A newly installed frontend extension only takes effect in a freshly loaded page.
Classic Notebook 6.x (not JupyterLab / Notebook 7): stay on the ipywidgets 7 line and make sure the nbextension is enabled:
jupyter nbextension enable --py --sys-prefix widgetsnbextension(This can be skipped for notebook version 5.3 and above, where it is enabled automatically.)
5. Checklist for the broken widget
Reproduce and capture the exact symptom: error-box text or browser-console (F12) message.
Classify: comm error (kernel half) vs model-module error (version mismatch) vs blank (check both halves).
Kernel half:
import ipywidgetsworks in the running kernel; re-run widget cells after every kernel restart.Browser half:
@jupyter-widgets/jupyterlab-managerpresent and enabled injupyter labextension list, major version matching the Python ipywidgets.- Resync with the upgrade command, then restart the kernel AND refresh the page.
Evidence
Built from the ipywidgets/jupyterlab-widgets installation documentation (version compatibility for JupyterLab 2.x/3.x/4.x), the PyPI dependency metadata for ipywidgets 7.x and 8.x (jupyterlab_widgets and widgetsnbextension requirements), and recurring Jupyter Discourse/GitHub threads on blank widgets and 'Cannot find model module' errors.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_RHL08VYbzbtIksSN0Q1kWQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fix ipywidgets that render blank or fail in JupyterLab <span>— Vectle</span></a>