Skip to content

ipywidgets 8 doesn't work with custom kernelspec #16923

@skkestrel

Description

@skkestrel

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Hello,

I'm using ipywidgets=8.1.7. I set up a custom kernelspec in a virtual environment (pyenv) as:

{
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "new python",
 "language": "python",
 "metadata": {
  "debugger": true
 }
}

which works normally, except for the fact that certain widgets (like tqdm.notebook.tqdm) don't work. I ran the following:

import tqdm.notebook

tqdm.notebook.tqdm(range(10))

Here's the error in vscode devtools:

Image

Details that might be helpful for troubleshooting:

  • I'm running this in WSL2.
  • The error goes away when I downgrade to ipywidgets v7.
  • The error also goes away when I use the regular "python environment" kernel instead of my custom kernelspec.
  • The widget also works normally with ipywidgets v8, with my custom kernel, in jupyter lab outside of vscode.

VS Code Version

1.103.1

Jupyter Extension Version

2025.7.0

Jupyter logs

20:51:02.227 [error] Widget load failure {} [ 'jsdelivr.com', 'unpkg.com' ] {
  className: 'HTMLStyleModel',
  moduleName: '@jupyter-widgets/controls',
  moduleVersion: '2.0.0',
  isOnline: true,
  timedout: false,
  error: '{}'
}
20:51:02.279 [error] Widget load failure {} [ 'jsdelivr.com', 'unpkg.com' ] {
  className: 'HTMLStyleModel',
  moduleName: '@jupyter-widgets/controls',
  moduleVersion: '2.0.0',
  isOnline: true,
  timedout: false,
  error: '{}'
}
20:51:02.279 [error] Widget Error: Error: Failed to render widget 8888a12f5ef348949cac79ab8e7cf23e, Error: Module @jupyter-widgets/controls, semver range ^2.0.0 is not registered as a widget module

Coding Language and Runtime Version

Python 3.12

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

N/A or Not sure

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posteripywidgetsRendering, loading, saving, anything to do with IPyWidgets

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions