ipywidgets: ipywidgets don't work on virtualenv

Hello all, When i start jupyter i have the next msg [IPKernelApp] ERROR | No such comm target registered: jupyter.widget.version and nothing happen when i try use ipywidgets in my jupyter-notebook

The step I’ve been doing from the starts when i creation my virtuelenv :

~ python3 -m virtualenv jupyter-notebook
~ pip3 install jupyter
 ~ jupyter nbextension enable --py --sys-prefix widgetsnbextension
Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: OK

~ jupyter-notebook and i have thisin stdout

[I 20:49:51.447 NotebookApp] Serving notebooks from local directory: /home/iah
[I 20:49:51.447 NotebookApp] The Jupyter Notebook is running at:
[I 20:49:51.447 NotebookApp] http://localhost:8888/
[I 20:49:51.447 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 20:49:55.116 NotebookApp] 404 GET /api/kernels/5f273170-5379-4e1f-a1e1-7e1aad4dd924/channels?session_id=dbe4008897bc4d52901320704498afe5 (127.0.0.1): Kernel does not exist: 5f273170-5379-4e1f-a1e1-7e1aad4dd924
[W 20:49:55.154 NotebookApp] 404 GET /api/kernels/5f273170-5379-4e1f-a1e1-7e1aad4dd924/channels?session_id=dbe4008897bc4d52901320704498afe5 (127.0.0.1) 55.74ms referer=None
[I 20:50:05.445 NotebookApp] Kernel started: 112db463-d31d-4e35-98d9-0db3b00fb107
[I 20:50:06.062 NotebookApp] Adapting to protocol v5.1 for kernel 112db463-d31d-4e35-98d9-0db3b00fb107
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.version
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.version

and what i have in my virtualenv

 ~ pip freeze
backcall==0.1.0
bleach==3.0.2
decorator==4.3.0
defusedxml==0.5.0
entrypoints==0.2.3
ipykernel==5.1.0
ipython==7.1.1
ipython-genutils==0.2.0
ipywidgets==7.4.2
jedi==0.13.1
Jinja2==2.10
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==6.0.0
jupyter-core==4.4.0
MarkupSafe==1.0
mistune==0.8.4
nbconvert==5.4.0
nbformat==4.4.0
notebook==5.7.0
pandocfilters==1.4.2
parso==0.3.1
pexpect==4.6.0
pickleshare==0.7.5
prometheus-client==0.4.2
prompt-toolkit==2.0.7
ptyprocess==0.6.0
Pygments==2.2.0
python-dateutil==2.7.5
pyzmq==17.1.2
qtconsole==4.4.2
Send2Trash==1.5.0
six==1.11.0
terminado==0.8.1
testpath==0.4.2
tornado==5.1.1
traitlets==4.3.2
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==3.4.2

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 30 (10 by maintainers)

Most upvoted comments

This error is accompanied for me with a The kernel for ___ appears to have died. It will restart automatically. error that never resolves.

Since ipywidgets nominally works in venv environments, likely this is a problem with the specific installation and older packages that had been installed, etc. My shot-in-the-dark guess is that this is a problem with the interaction between user-level and environment-level paths in Jupyter, combined with old packages being installed at the user level. We recently addressed a situation where ipywidgets installed in a venv was broken over in https://github.com/jupyter-widgets/ipywidgets/issues/3559. The solution there was to (a) delete old ipywidgets packages in ~/.local/jupyter, and (b) set the JUPYTER_PREFER_ENV_PATH environment variable to prefer packages installed in the environment over packages installed in the user-level directories.

For whoever is having this problem: can you (a) don’t use jupyter labextension install - just installing recent ipywidgets versions should automatically install the JupyterLab 3 extension, and (b) check jupyter --paths --debug to see where Jupyter is picking up extensions, and © do jupyter labextension list to see what versions and where the lab extension was coming from?

we wait a few more years?

Please be kind. I think that comment was unnecessarily sarcastic.

not incur into this kernel comm ERROR and WARNING

The gist of @martinRenou’s message is that this particular message is logged as an error, but actually is harmless, and should really be classified as an informational message. @martinRenou points out that we have other proposals open in Jupyter to correct the actual problem (that this pattern shows an error message, but actually should not signal an error), rather than preventing the message.

Is someone fixing this, or… we wait a few more years?

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control

What is happening when you see this error is most likely the following:

  • ipywidgets on the back-end (ipykernel) has not been imported yet (so the jupyter.widget.control comm target has not been registered yet on the back-end)
  • The front-end is trying to fetch the widgets models by connecting to the jupyter.widget.control comm target.
  • The back-end fails to respond on that target which is not yet registered and shows an error.
  • The front-end handles the failure to respond and loads widgets using another method

I believe the kernel comm protocol is lacking an extra message for the front-end to request “which are the comm targets that are registered”. There is a JEP open for that purpose: https://github.com/jupyter/enhancement-proposals/issues/86

TLTR: This error should not cause any rendering issue on the widget. If you see widgets working, you can simply ignore the error for now. If you don’t see the widgets working, this is most likely another issue that is happening.