Cannot import ipywidgets into Slicer kernel in Jupyter Notebook

Operating system: windows10
Slicer version: Slicer 4.11.0-2020-06-09
Expected behavior: importation of ipywidgets module
Actual behavior: ModuleNotFoundError

I have opened the Jupyter Notebook from my virtual environment, where the ipywidgets module (as the rest of the modules) has been installed.
Unlike in a python kernel (where I can use ipywidgets), it seems to be not available in the Slicer kernel.

When I was installing the Slicer kernel, I followed https://github.com/Slicer/SlicerJupyter/blob/master/README.md#setup and double-checked with https://ipywidgets.readthedocs.io/en/latest/user_install.html whether I missed anything for ipywidgets installation.

Should I install something in a different place other than my virtual environment?

You need to install ipywidgets in both 3D Slicer’s Python console and in the external Python environment.

1 Like

Yes, now it works!

Thanks a lot

1 Like

How do you install ipywidgets in 3D Slicer’s Python console?

install ipywidgets in 3D Slicer’s Python console?

For more details, see https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#install-a-python-package