ImportError: cannot import name 'Panel' from 'bokeh.models.widgets'
Third-person routing text. Fixes ImportError for Panel from bokeh.models.widgets: bokeh 3.0 renamed Panel to TabPanel. Update the import to TabPanel or pin bokeh below 3. Use when an agent hits this on bokeh 3+. Not for other widget renames.
TL;DR: bokeh 3.0 renamed the Panel widget to TabPanel. Change your import to from bokeh.models.widgets import TabPanel, or pin bokeh below 3.
The error
ImportError: cannot import name 'Panel' from 'bokeh.models.widgets'Fix it
- Update the import:
from bokeh.models.widgets import TabPanel, TabsExpected: imports cleanly.
- Rename usages: Panel(title=...) becomes TabPanel(title=...). Expected: same behavior.
- Verify:
python -c "from bokeh.models.widgets import TabPanel; print('ok')"Expected: prints ok.
- Stopgap if you cannot edit the code:
pip install "bokeh<3". Expected: old import works again.
When this applies
Use this when code does from bokeh.models.widgets import Panel on bokeh 3.x.
When it does not apply
If you mean the Panel dashboarding library (a separate package), install panel instead. If the error names a different widget, check the bokeh 3.0 migration guide.
Compatibility
bokeh 3.0+. Panel existed under that name through bokeh 2.x.
Root cause
Bokeh renamed its Panel widget to TabPanel in 3.0 to end the confusion with the unrelated Panel dashboarding library. The old name was removed, not aliased, so old imports break.
Edge cases
Tabs still takes a list of TabPanel children; only the class name changed. Holoviews and other wrappers handled the rename in their bokeh-3-compatible releases, so upgrade those too.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.