jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.15k stars 949 forks source link

ipywidgets don't work on virtualenv #2257

Closed knight-rider-2000 closed 1 year ago

knight-rider-2000 commented 5 years ago

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
Cbhihe commented 2 years ago

Exact same problem here on Arch linux with

Error message: [I 08:24:22.080 NotebookApp] Jupyter Notebook 6.4.6 is running at: [I 08:24:22.080 NotebookApp] http://localhost:8888/ [I 08:24:22.080 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [I 08:24:23.379 NotebookApp] 302 GET /notebooks/graph.ipynb (127.0.0.1) 1.780000ms [I 08:24:24.575 NotebookApp] 302 POST /login?next=%2Fnotebooks%2Fgraph.ipynb (127.0.0.1) 0.880000ms [W 08:24:26.058 NotebookApp] Notebook graph.ipynb is not trusted [I 08:24:29.007 NotebookApp] Kernel started: 4f31cef7-419f-4044-8c55-4e4e9793956a, name: mscocoapi [IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control [IPKernelApp] WARNING | No such comm: 7dd0ce6c-b5bb-45d6-88c0-83eeeceb272c

jasongrout commented 2 years ago

@Cbhihe - can you list all of the python packages you have installed and their version numbers? In particular, ipywidgets, notebook, jupyterlab. Can you post exactly the error message you see?

Cbhihe commented 2 years ago

After a Jupyter Notebook routine upgrade, the IPKernelApp error and warning remain.

Whether I use jupyter notebookor jupyter nbclassic to launch the ipynb document, makes no difference. I get the exact same error message (by that I mean the two last line of the launch trace below).

$ jupyter notebook /home/USER/my_notebook.ipynb
[I 09:35:07.228 NotebookApp] Serving notebooks from local directory: /home/USER/my_notebook.ipynb
[I 09:35:07.228 NotebookApp] Jupyter Notebook 6.4.10 is running at:
[I 09:35:07.229 NotebookApp] http://localhost:8888/
[I 09:35:07.229 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 09:35:08.524 NotebookApp] 302 GET /notebooks/my_notebook.ipynb (127.0.0.1) 1.340000ms
[I 09:35:16.968 NotebookApp] 302 POST /login?next=%2Fnotebooks%2Fmy_notebook.ipynb (127.0.0.1) 1.580000ms
[I 09:35:20.974 NotebookApp] Kernel started: 5e0ab85d-0d93-40f7-b9fd-793a8cb754f8, name: my_ipykernel
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: a1ffa747-3916-4e63-a671-9dc191ca03d1
$ jupyter --version
Selected Jupyter core packages...
IPython          : 7.20.0
ipykernel        : 5.4.0
ipywidgets       : 7.7.0
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
jupyter_server   : 1.16.0
jupyterlab       : 3.3.3
nbclient         : 0.5.9
nbconvert        : 6.5.0
nbformat         : 5.3.0
notebook         : 6.4.10
qtconsole        : 5.2.2
traitlets        : 5.1.1

$ python -m pip freeze
...
ipykernel==5.4.0
ipython==7.20.0
ipython-genutils==0.2.0
ipywidgets==7.7.0
...
jupyter==1.0.0
jupyter-client==7.1.0
jupyter-console==6.4.3
jupyter-core==4.9.1
jupyter-server==1.16.0
jupyterlab==3.3.3
jupyterlab-pygments==0.1.2
jupyterlab-server==2.12.0
jupyterlab-widgets==1.1.0
...
nbclassic==0.3.7
nbclient==0.5.9
nbconvert==6.5.0
nbformat==5.3.0
...
notebook==6.4.10
notebook-shim==0.1.0
...
widgetsnbextension==3.6.0
...

When using the new jupyter server, I can check my currently enabled extensions:

$ jupyter server extension list
Config dir: /home/USER/.jupyter
Config dir: /home/USER/.pyenv/versions/3.9.0/etc/jupyter
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 3.3.3 OK
    nbclassic enabled
    - Validating nbclassic...
      nbclassic  OK
    notebook_shim enabled
    - Validating notebook_shim...
      notebook_shim  OK
Config dir: /usr/local/etc/jupyter
utkonos commented 2 years ago

I am encountering this error in a fresh install of Ubuntu 22.04 LTS. I have installed Python 3.10.4 from source + altinstall and I'm using a virtual environment created using python3.10 -m venv venv and Node.js 16.14.2 LTS is installed using nvm then npm is self updated and then audited. The virtual environment is fully updated with setuptools, pip, and wheel before running the following commands to get jupyter installed and running. I have not deviated from the installation process used in the past.

pip install jupyterlab ipywidgets
jupyter nbextension enable --py widgetsnbextension --sys-prefix
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter lab

Here is the error:

$ jupyter lab
[I 2022-04-25 04:12:29.794 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-04-25 04:12:29.800 ServerApp] nbclassic | extension was successfully linked.
[I 2022-04-25 04:12:29.801 ServerApp] Writing Jupyter server cookie secret to /home/jupyternode16/.local/share/jupyter/runtime/jupyter_cookie_secret
[I 2022-04-25 04:12:29.911 ServerApp] notebook_shim | extension was successfully linked.
[I 2022-04-25 04:12:29.921 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-04-25 04:12:29.922 LabApp] JupyterLab extension loaded from /home/jupyternode16/venv/lib/python3.10/site-packages/jupyterlab
[I 2022-04-25 04:12:29.922 LabApp] JupyterLab application directory is /home/jupyternode16/venv/share/jupyter/lab
[I 2022-04-25 04:12:29.924 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-04-25 04:12:29.926 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-04-25 04:12:29.927 ServerApp] Serving notebooks from local directory: /home/jupyternode16/work
[I 2022-04-25 04:12:29.927 ServerApp] Jupyter Server 1.16.0 is running at:
[I 2022-04-25 04:12:29.927 ServerApp] http://localhost:8888/lab?token=62c25ce8349fd2d7ce342741a58721e138c0828c49810842
[I 2022-04-25 04:12:29.927 ServerApp]  or http://127.0.0.1:8888/lab?token=62c25ce8349fd2d7ce342741a58721e138c0828c49810842
[I 2022-04-25 04:12:29.927 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2022-04-25 04:12:29.929 ServerApp] No web browser found: could not locate runnable browser.
[C 2022-04-25 04:12:29.929 ServerApp] 

    To access the server, open this file in a browser:
        file:///home/jupyternode16/.local/share/jupyter/runtime/jpserver-18320-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=62c25ce8349fd2d7ce342741a58721e138c0828c49810842
     or http://127.0.0.1:8888/lab?token=62c25ce8349fd2d7ce342741a58721e138c0828c49810842
[W 2022-04-25 04:12:34.123 ServerApp] Clearing invalid/expired login cookie username-localhost-8889
[W 2022-04-25 04:12:34.124 LabApp] Clearing invalid/expired login cookie username-localhost-8889
[I 2022-04-25 04:12:34.124 LabApp] 302 GET /lab (127.0.0.1) 0.93ms
[I 2022-04-25 04:12:41.700 ServerApp] 302 POST /login?next=%2Flab (127.0.0.1) 0.60ms
[I 2022-04-25 04:12:44.285 LabApp] Build is up to date
[I 2022-04-25 04:12:51.249 ServerApp] Creating new notebook in 
[I 2022-04-25 04:12:51.266 ServerApp] Writing notebook-signing key to /home/jupyternode16/.local/share/jupyter/notebook_secret
[I 2022-04-25 04:12:51.705 ServerApp] Kernel started: 96512ec4-757f-4626-8b31-2d9fb7cdda1c
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: 984cc1b1-11bc-46b5-9a1b-be93fe001daa
[I 2022-04-25 04:14:02.267 ServerApp] Kernel shutdown: 96512ec4-757f-4626-8b31-2d9fb7cdda1c
[W 2022-04-25 04:14:02.439 ServerApp] delete /Untitled.ipynb
[I 2022-04-25 04:14:05.811 ServerApp] Shutting down on /api/shutdown request.
[I 2022-04-25 04:14:05.811 ServerApp] Shutting down 3 extensions
[I 2022-04-25 04:14:05.812 ServerApp] Shutting down 0 kernels
[I 2022-04-25 04:14:05.812 ServerApp] Shutting down 0 terminals

Here is the list of installed packages:

$ pip list
Package              Version
-------------------- -----------
anyio                3.5.0
argon2-cffi          21.3.0
argon2-cffi-bindings 21.2.0
asttokens            2.0.5
attrs                21.4.0
Babel                2.10.1
backcall             0.2.0
beautifulsoup4       4.11.1
bleach               5.0.0
certifi              2021.10.8
cffi                 1.15.0
charset-normalizer   2.0.12
debugpy              1.6.0
decorator            5.1.1
defusedxml           0.7.1
entrypoints          0.4
executing            0.8.3
fastjsonschema       2.15.3
idna                 3.3
ipykernel            6.13.0
ipython              8.2.0
ipython-genutils     0.2.0
ipywidgets           7.7.0
jedi                 0.18.1
Jinja2               3.1.1
json5                0.9.6
jsonschema           4.4.0
jupyter-client       7.2.2
jupyter-core         4.10.0
jupyter-server       1.16.0
jupyterlab           3.3.4
jupyterlab-pygments  0.2.2
jupyterlab-server    2.13.0
jupyterlab-widgets   1.1.0
MarkupSafe           2.1.1
matplotlib-inline    0.1.3
mistune              0.8.4
nbclassic            0.3.7
nbclient             0.6.0
nbconvert            6.5.0
nbformat             5.3.0
nest-asyncio         1.5.5
notebook             6.4.11
notebook-shim        0.1.0
packaging            21.3
pandocfilters        1.5.0
parso                0.8.3
pexpect              4.8.0
pickleshare          0.7.5
pip                  22.0.4
prometheus-client    0.14.1
prompt-toolkit       3.0.29
psutil               5.9.0
ptyprocess           0.7.0
pure-eval            0.2.2
pycparser            2.21
Pygments             2.12.0
pyparsing            3.0.8
pyrsistent           0.18.1
python-dateutil      2.8.2
pytz                 2022.1
pyzmq                22.3.0
requests             2.27.1
Send2Trash           1.8.0
setuptools           62.1.0
six                  1.16.0
sniffio              1.2.0
soupsieve            2.3.2.post1
stack-data           0.2.0
terminado            0.13.3
tinycss2             1.1.1
tornado              6.1
traitlets            5.1.1
urllib3              1.26.9
wcwidth              0.2.5
webencodings         0.5.1
websocket-client     1.3.2
wheel                0.37.1
widgetsnbextension   3.6.0

So that we're comparing apples to apples, start a DigitalOcean droplet 20.04 LTS. Then run the following commands from my history.

    1  apt update
    2  apt upgrade
    3  reboot
    4  apt install python3-venv jq
    5  python3 -m venv venv
    6  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    7  nvm install --lts
    8  npm install npm
    9  source venv/bin/activate
   10  pip list -o --format json | jq -r '.[].name' | xargs -n 1 pip install -U
   11  pip install wheel jupyterlab ipywidgets
   12  jupyter nbextension enable --py widgetsnbextension --sys-prefix
   13  jupyter labextension install @jupyter-widgets/jupyterlab-manager
   14  jupyter lab --allow-root

Error

# jupyter lab --allow-root
[I 2022-04-25 04:34:55.710 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-04-25 04:34:55.718 ServerApp] nbclassic | extension was successfully linked.
[I 2022-04-25 04:34:55.864 ServerApp] notebook_shim | extension was successfully linked.
[I 2022-04-25 04:34:55.887 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-04-25 04:34:55.888 LabApp] JupyterLab extension loaded from /root/venv/lib/python3.8/site-packages/jupyterlab
[I 2022-04-25 04:34:55.888 LabApp] JupyterLab application directory is /root/venv/share/jupyter/lab
[I 2022-04-25 04:34:55.891 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-04-25 04:34:55.894 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-04-25 04:34:55.895 ServerApp] Serving notebooks from local directory: /root
[I 2022-04-25 04:34:55.895 ServerApp] Jupyter Server 1.16.0 is running at:
[I 2022-04-25 04:34:55.895 ServerApp] http://localhost:8888/lab?token=5dbf385b1f95188e291834d1be75880367abc26ac15727b8
[I 2022-04-25 04:34:55.895 ServerApp]  or http://127.0.0.1:8888/lab?token=5dbf385b1f95188e291834d1be75880367abc26ac15727b8
[I 2022-04-25 04:34:55.895 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2022-04-25 04:34:55.898 ServerApp] No web browser found: could not locate runnable browser.
[C 2022-04-25 04:34:55.898 ServerApp] 

    To access the server, open this file in a browser:
        file:///root/.local/share/jupyter/runtime/jpserver-3132-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=5dbf385b1f95188e291834d1be75880367abc26ac15727b8
     or http://127.0.0.1:8888/lab?token=5dbf385b1f95188e291834d1be75880367abc26ac15727b8
[W 2022-04-25 04:35:00.791 ServerApp] Clearing invalid/expired login cookie username-localhost-8889
[W 2022-04-25 04:35:00.792 LabApp] Clearing invalid/expired login cookie username-localhost-8889
[I 2022-04-25 04:35:00.792 LabApp] 302 GET /lab (::1) 1.75ms
[I 2022-04-25 04:35:07.296 ServerApp] 302 POST /login?next=%2Flab (::1) 1.15ms
[I 2022-04-25 04:35:10.841 LabApp] Build is up to date
[I 2022-04-25 04:35:15.079 ServerApp] Creating new notebook in 
[I 2022-04-25 04:35:15.114 ServerApp] Writing notebook-signing key to /root/.local/share/jupyter/notebook_secret
[I 2022-04-25 04:35:15.729 ServerApp] Kernel started: cae13a92-8db1-4ca0-937d-b94ae4b089f5
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: f6ec70c4-ce54-420d-8e55-b39b9da38abd
[I 2022-04-25 04:35:22.855 ServerApp] Kernel shutdown: cae13a92-8db1-4ca0-937d-b94ae4b089f5
[I 2022-04-25 04:35:23.230 ServerApp] Shutting down on /api/shutdown request.
[I 2022-04-25 04:35:23.231 ServerApp] Shutting down 3 extensions
[I 2022-04-25 04:35:23.231 ServerApp] Shutting down 0 kernels
[I 2022-04-25 04:35:23.231 ServerApp] Shutting down 0 terminals
utkonos commented 2 years ago

This issue is appearing elsewhere in other bug trackers:

https://bbs.archlinux.org/viewtopic.php?id=274933

Also here:

https://github.com/jupyterlab/jupyterlab/issues/11934

And here:

https://github.com/CADLabs/radCAD/issues/45

A package changed on or around March 17th:

https://www.google.com/search?q=%22No+such+comm+target+registered%3A+jupyter.widget.control%22

martinRenou commented 2 years ago
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control

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

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.

Cbhihe commented 2 years ago

Tx, utkonos and martin.
I don't want to add noise to this thread [just a regular user speaking here...], but the Archlinux troubleshooting forum post (referred to as a "bug tracker" by @utkonos) suggests that, when using a Python virtual environment, the custom ipykernel must be re-built and all packages installed so it can (somehow) take all Jupyter extensions into account and not incur into this kernel comm ERROR and WARNING. In other words re-building the custom ipykernel solves the issue by making the kernel aware of necessary comm target(s). How and why exactly is beyond me.
Will try this workaround (rebulding my custom ipykernel with all packages) and report here if there is any interest in such a feeble attempt to contribute something.

jasongrout commented 2 years ago

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.

peterjoyaa commented 2 years ago

dou you fix it?

eabase commented 2 years ago

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

jasongrout commented 2 years ago

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 (c) 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.

utkonos commented 2 years ago

I am still seeing these two:

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: 131bdb84-3ea3-4c30-84bb-4fbbd885668a

I have removed the step during the install process for jupyter labextension install. This is a fresh Ubuntu 22.04 LTS VM. The following are the only commands that have been run on the VM. I am using Vagrant, and this is my install.sh.

#!/bin/bash
## Set environment
export DEBIAN_FRONTEND=noninteractive

## Update Ubuntu
sleep 20
echo 'APT::Get::Always-Include-Phased-Updates "1";' | tee /etc/apt/apt.conf.d/80PhasedUpdates
apt-get update
apt-get --with-new-pkgs upgrade -y
apt-get autoremove -y
apt-get autoclean -y

## Configure tmux
echo 'set -g default-terminal "tmux-256color"' | tee /etc/tmux.conf

## Install Python
dpkg -i /data/python3.10_3.10.6-1_amd64.deb

## Install Jupyter
apt-get install -y jq
sudo -i -u vagrant bash << EOF
python3.10 -m venv /home/vagrant/venv
source /home/vagrant/venv/bin/activate
pip list -o --format json | jq -r '.[].name' | xargs -n 1 pip install -U
pip install wheel
pip install jupyterlab ipywidgets
EOF

## Reboot
reboot

Here is the output from the other commands:

$ jupyter --paths --debug
JUPYTER_PREFER_ENV_PATH is not set, making the user-level path preferred over the environment-level path for data and config
JUPYTER_NO_CONFIG is not set, so we use the full path list for config
JUPYTER_CONFIG_PATH is not set, so we do not prepend anything to the config paths
JUPYTER_CONFIG_DIR is not set, so we use the default user-level config directory
Python's site.ENABLE_USER_SITE is not True, so we do not add the Python site user directory '/home/vagrant/.local'
JUPYTER_PATH is not set, so we do not prepend anything to the data paths
JUPYTER_DATA_DIR is not set, so we use the default user-level data directory
JUPYTER_RUNTIME_DIR is not set, so we use the default runtime directory

config:
    /home/vagrant/.jupyter
    /home/vagrant/venv/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/vagrant/.local/share/jupyter
    /home/vagrant/venv/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/vagrant/.local/share/jupyter/runtime
$ jupyter labextension list
JupyterLab v3.4.5
/home/vagrant/venv/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @jupyter-widgets/jupyterlab-manager v5.0.2 enabled OK (python, jupyterlab_widgets)

For completeness, so anyone can verify the above, here is my Vagrantfile.

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
  config.vm.box = 'ubuntu/jammy64'
  config.vm.synced_folder 'data', '/data'
  config.vm.provider 'virtualbox' do |vb|
    vb.gui = false
    vb.memory = '32768'
    vb.cpus = '6'
  end
  config.vm.provision 'shell', path: 'install.sh'
end
freiburgermsu commented 2 years ago

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

do-me commented 2 years ago

I can confirm the error in a conda env on Ubuntu 20.04 and Windows 10, only that sometimes no error shows up - neither in Jupyter Lab directly nor in the browser console. The cell gets executed but nothing is showing up. The tiny blue side bar below the cell indicates however that something has happened:

After a while I discovered a weird Jupyter bug:

  1. I keep two different notebooks in Jupyter Lab open at the same time with the same code (same server!)
  2. I import from IPython.display import display, HTML and execute the display function in notebook 1, everything showing up properly
  3. I execute the exact same display function in notebook 2 after the import, nothing happens as described in the beginning. Instead, the display function is triggered again in notebook 1 and the output is displayed there twice!

Hence, I only work with one notebook at the moment.

If anyone is interested in replication: Simply open two notebooks, copy this code for a simple word cloud generation from d3wordcloud in one cell, add the function call display_wordcloud(text) in the end of the cell and replace text in the function with any space separated list of words. Execute in notebook 1, then 2.

utkonos commented 2 years ago

Just checking in here. With a fresh install, this error and warning are still happening.

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
ztsweet commented 1 year ago

the error still happen

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

tzdm commented 1 year ago

I have the same problem, is there a solution?

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control [IPKernelApp] WARNING | No such comm: b0a04cb2-ddef-41e0-9153-1efbae498acc [IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control [IPKernelApp] WARNING | No such comm: 1b0bc407-0842-4963-98dc-0f288d51648d

huazai-beyond121 commented 1 year ago

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

I suffered the same difficulty as you!same error and kernel died!/crying

martinRenou commented 1 year ago

Closing as answered.

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

is not an error, it's only a warning, and it cannot be a reason for the kernel to die. If your kernel is dying, it's due to something else.

AzimAhmadzadeh commented 1 year ago

It's been said multiple times that this is harmless, but (at least for me) it is not. The modules that I can import using a python script cannot be imported using a Jupyter notebook. The only error/warning that I see is:

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: c3ebc8bd-4485-4f01-9bf9-26cf34015ada

I am using PyCharm, Ubuntu 22, both freshly installed.

martinRenou commented 1 year ago

@AzimAhmadzadeh Can you tell us which ipykernel version you have? Please make sure to have the very latest, the recent ipykernel versions had issues with ipywidgets

AzimAhmadzadeh commented 1 year ago

@martinRenou Uninstalling jupyterlab_widgets did not help.

Regarding your question: I am using ipykernel==6.15.0.

And here are other related libraries that are automatically installed:

jupyter==1.0.0
jupyter-console==6.4.4
jupyter-events==0.5.0
jupyter_client==7.4.8
jupyter_core==5.1.0
jupyter_server==2.0.1
jupyter_server_terminals==0.4.2
jupyterlab-pygments==0.2.2
nbclassic==0.4.8
nbclient==0.7.2
nbconvert==7.2.6
nbformat==5.7.0
widgetsnbextension==4.0.4
jupyterlab-pygments==0.2.2
notebook==6.5.2
notebook_shim==0.2.2
martinRenou commented 1 year ago

What did you see when uninstalling jupyterlab_widgets? I suppose you didn't see the [IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control error, right?

AzimAhmadzadeh commented 1 year ago

Yes. The problem remains to be ModuleNotFoundError, but I don't get the previous error. Instead, I get:

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: 0716df1c-982b-43c5-bc0b-70e8ac6105a6
martinRenou commented 1 year ago

The problem remains to be ModuleNotFoundError

You did not mention a ModuleNotFoundError error, what is it?

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

This "error" (I'm going to insist putting quotes, it's just a warning 😅) comes from jupyterlab_widgets trying to open the jupyter.widget.control. If you still see this error, you did not uninstall it properly. Starting from a clean environment could probably help.

AzimAhmadzadeh commented 1 year ago

You did not mention a ModuleNotFoundError error, what is it?

That's the error python gives you when it does not find your imported module. That's why I've been saying that this is not "harmless".

I created a new project and tried to reproduced the issue with mock modules. I could not. Probably the issue lies somewhere else but the jupyter.widget.control error is the only thing being shown. I will dig into this further and update you here.

poxlox commented 1 year ago

I would like to +1 for this issue and request it be opened again: Env: Windows, Python 3.11, Jupyterlab, tons of packages used, namely pandas, scheduler, boto3. The negative side effects are dead/unresponsive kernels, functions eventually break, so yeah not harmless. Appreciate any help, I'll post my full error lines

0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.05s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[W 21:14:11.263 NotebookApp] Notebook Google Analytics Bot.ipynb is not trusted
[I 21:14:12.379 NotebookApp] Kernel started: c33a4106-3877-4b7d-8f94-52f610c646b2, name: python3
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: 6002125b-96ce-4248-8227-e571d64f9574
martinRenou commented 1 year ago

That's the error python gives you when it does not find your imported module.

I know what a ModuleNotFoundError is, thank you 😅 what I'm saying is that you did not mention having this error before, and you did not share the traceback showing this error, I cannot help you if you do not provide all the information you have.

There have been multiple broken ipykernel releases recently, please make sure to update to the latest ipykernel (6.19.3 as of today).

AzimAhmadzadeh commented 1 year ago

I know what a ModuleNotFoundError is, thank you sweat_smile

No need to be condescending. You asked "what is it?" Also, I was trying to explain that I implicitly mentioned this error in my previous comment.

Regarding the compiler error, there was no trackback; it was a single import that failed and a single line of error. Unfortunately, since I resolved my issue (see below) I do not have the Jupyter-server's log to report, but it was similar to what @poxlox reported. Env: [Ubuntu 22, PyCharm 22.3 (stable/latest)]

I found the issue in my case: In my case, it was related to the new version of PyCharm 22.3 (stable/latest), which currently has issues with notebooks (https://youtrack.jetbrains.com/issue/PY-57823). I could not reproduce this error in a fresh project, but as soon as I switched back to PyCharm 22.2.4 all modules were found as expected.

martinRenou commented 1 year ago

Happy you could find your issue!

I'm locking this conversation. To anyone reading this, if you think you have a similar issue, please open a separate one with your specific setup.