# Widgets fail to render Debian 12 J Lab 4.3

**URL:** <https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264>\
**Category:** Widgets\
**Created:** [December 28, 2024, 8:33pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264 "2024-12-28T20:33:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpark](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jpark/32/16574_2.png) [@jpark](https://discourse.jupyter.org/u/jpark)\
**Post date:** [December 28, 2024, 8:33pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/1 "2024-12-28T20:33:36Z")

</div>

Greetings all. I’m new here, instigated by an OS upgrade and migration from notebook to Lab. I have an ipywidgets GUI frontend for the [pyEDM · PyPI](https://pypi.org/project/pyEDM/) package, and would like to bring it in compliance with J Lab.

However, a baseline example from the ipywidgets intro docs:

```python
import ipywidgets as widgets
from IPython.display import display
w = widgets.IntSlider()
display(w)

```

does not render the widget, rather a text description:

```auto
IntSlider(value=0)

```

It seems something fundamental is amiss, or perhaps I am incorrectly using the methods.

Thank you!

### System Info

```auto
~> lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm
~> uname -a
Linux xxx 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux

```

### Environment

```auto
~> jupyter --version
Selected Jupyter core packages...
IPython : 8.31.0
ipykernel : 6.29.5
ipywidgets : 8.1.5
jupyter_client : 8.6.3
jupyter_core : 5.7.2
jupyter_server : 2.15.0
jupyterlab : 4.3.4
nbclient : 0.10.2
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.3.2
qtconsole : 5.6.1
traitlets : 5.14.3

```

```auto
~> firefox --version
Mozilla Firefox 128.5.0esr

```

---

<div class="post-metadata">

**Author:** ![jpark](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jpark/32/16574_2.png) [@jpark](https://discourse.jupyter.org/u/jpark)\
**Post date:** [January 14, 2025, 3:37pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/2 "2025-01-14T15:37:16Z")

</div>

Would downgrading be a workaround? If so, version suggestions? Please. This is preventing progress on use/upgrade of the package UI.

It appears an `async _handleCommOpen(msg)` request is failing.

```auto
Some cookies are misusing the recommended “SameSite“ attribute 62
Language pack 'en_US' not installed! manager.js:49:20
Starting application in workspace: "default" index.js:496:16
Disabling terminals plugin because they are not available on the server index.js:69:16
SyntaxError: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data serverconnection.js:90:24
SyntaxError: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data serverconnection.js:90:24
Starting WebSocket: ws://localhost:8888/api/kernels/7a28b57b-e70f-40c2-bf34-ed3fa3b10da5 default.js:69:20
Starting WebSocket: ws://localhost:8888/api/kernels/7a28b57b-e70f-40c2-bf34-ed3fa3b10da5 default.js:69:20
Starting WebSocket: ws://localhost:8888/api/kernels/7a28b57b-e70f-40c2-bf34-ed3fa3b10da5 default.js:69:20
Exception opening new comm 3 default.js:1124:20
    _handleCommOpen default.js:1124
    _handleMessage default.js:1286
    _msgChain default.js:179
    (Async: promise callback)
    _onWSMessage default.js:176
    (Async: EventHandlerNonNull)
    _createSocket default.js:135
    C default.js:243
    connectTo manager.js:106
    _connectToKernel manager.js:31
    setupKernel default.js:281
    a default.js:46
    connectTo manager.js:96
    startNew manager.js:142
    _changeKernel sessioncontext.js:552
    startKernel sessioncontext.js:334
    _startIfNecessary sessioncontext.js:511
    _initialize sessioncontext.js:450
    initialize sessioncontext.js:418
    _populate context.js:488
    _revert context.js:603
    (Async: promise callback)
    _revert context.js:574
    initialize context.js:204
    c manager.js:551
    (Async: promise callback)
    _createOrOpenDocument manager.js:551
    open manager.js:375
    openOrReveal manager.js:402
    handleOpen listing.js:1305
    evtDblClick listing.js:1514
    handleEvent listing.js:664

```

The error appears to be in `default.js`:

```java
    /**
     * Handle a `comm_open` kernel message.
     */
    async _handleCommOpen(msg) {
        this._assertCurrentMessage(msg);
        const content = msg.content;
        const comm = new comm_1.CommHandler(content.target_name, content.comm_id, this, () => {
            this._unregisterComm(content.comm_id);
        });
        this._comms.set(content.comm_id, comm);
        try {
            const target = await Private.loadObject(content.target_name, content.target_module, this._targetRegistry);
            await target(comm, msg);
        }
        catch (e) {
            // Close the comm asynchronously. We cannot block message processing on
            // kernel messages to wait for another kernel message.
            comm.close();
            console.error('Exception opening new comm');
            throw e;
        }
    }

```

Although I do not know if the preceding terminal & JSON warning are pertinent:

```auto
Disabling terminals plugin because they are not available on the server index.js:69:16
SyntaxError: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data serverconnection.js:90:24

```

Any suggestions/direction for prognosis or progress are appreciated.

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [January 14, 2025, 3:59pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/3 "2025-01-14T15:59:34Z")

</div>

> [@jpark](#):
>
> does not render the widget, rather a text description

Have you tried a hard refresh on the browser page since this update? (Open Jupyter with that test notebook and then do the hard refresh.) Or tried a new browser all together? One you don’t use regularly with Jupyter. It can be hard to be really clear things out when dealing with the browser that ran older code. It can really mislead you.

You can see that probably the issue is inherent in your installation/environment or browser pages using your installation because I bet if you go [here](https://gist.github.com/jtpio/f3f7aed7c87bb15e07009bb29a601ed8) and click on the ‘`launch binder`’ badge to start a new temporary and then run your code in a new notebook, it will work. That is giving JupyterLab 4.4 & not 4.3 right not, but I think that beside the point. I don’t think it is the version that is causing your problem so much as your environment. You should really clean things out before installing the latest if you are making a big jump like it sounds like you did.

> [@jpark](#):
>
> Would downgrading be a workaround? If so, version suggestions? Please. This is preventing progress on use/upgrade of the package UI.

For those reasons, I don’t think downgrading is going to help you. But as a workaround you can use a MyBinder-served session or Anaconda Cloud served session to maybe continue development/testing while you sort that environment issue out.

---

<div class="post-metadata">

**Author:** ![jpark](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jpark/32/16574_2.png) [@jpark](https://discourse.jupyter.org/u/jpark)\
**Post date:** [January 14, 2025, 5:53pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/4 "2025-01-14T17:53:08Z")

</div>

@fomightez : Thanks for the suggestions!

This is a clean install of Debian 12, python, Jupyter lab, etc. No previous versions existed. In naiviety I would agree it is likely a system/config issue, but have no clear direction to assess that.

> Have you tried a hard refresh on the browser

Yes. Tried:

```auto
jupyter lab --NotebookApp.default_url=/lab?reset

```

Same result. Widgets not rendered.

> Or tried a new browser all together?

Yes. Chromium Version 131.0.6778.204 (Official Build) built on Debian GNU/Linux 12 (bookworm) (64-bit)

Same result.

Also disabled ad-blocker. I wondered if the fact that Debian 12 uses Wayland instead X could be an issue… but that seems farfetched.

One distinction is that this is not a system install of python, but a local build of 3.13.1, but it operates flawlessly in all respects.

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [January 14, 2025, 6:29pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/5 "2025-01-14T18:29:29Z")

</div>

> [@jpark](#):
>
> Have you tried a hard refresh on the browser

Maybe you tried what I suggested but you also put `jupyter lab --NotebookApp.default_url=/lab?reset` just below where you say you tried. I’m not sure that is the same thing. So just checking.

What I meant was:  
Like supposedly for Chrome on Linux, when you are on the `.ipynb` page in Jupyter you’d do: `Hold the ⇧ Shift key and press the R key`. That is what I referring to for refreshing the page.

But since you tried a different browser, it actually probably won’t help you here.

* * *

On the off chance it might help you get `ipywidgets` working in your case:  
Can you try running `%pip install ipywidgets` in your notebook where you want to run the test. Run that and then restart everything. It will mention the kernel, of course, but that isn’t all that I mean. I mean shutdown and restart the machine, browser, Jupyter. All of it. Then before trying to run the test code refresh the browser page, too. Then try running the test code again in that notebook.

---

<div class="post-metadata">

**Author:** ![jpark](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jpark/32/16574_2.png) [@jpark](https://discourse.jupyter.org/u/jpark)\
**Post date:** [January 14, 2025, 7:50pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/6 "2025-01-14T19:50:56Z")

</div>

Thanks for the suggestions.

Shift-R seems to toggle the view from cell output below to the side. Perhaps you are referring to restarting the python kernel and clearing all cells? In all cases the result is the same. Since I set the browser to clear cache etc everytime it shuts down, I suspect that satisfies the page refresh criteria.

Also tried `%pip install ipywidgets` in the notebook. It reports there is nothing to do since it is already installed, and the result is the same.

I would like to understand why this exception is raised:

```auto
Exception opening new comm 3 default.js:1124:20
    _handleCommOpen default.js:1124

```

That seems to be an aspect of the problem.

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [January 15, 2025, 4:10pm UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/7 "2025-01-15T16:10:22Z")

</div>

Sorry. I am not working on a Linux machine so I copied what it said for a refreshing a browser page in chrome from some place. Apparently, it was wrong.

That does seem to indicate part of the issue. But other than letting you know you need to get a good install of everything, I don’t know really what it gets you.  
I wonder if it there is a way to force the `%pip install ipywidgets`? (I know there is a force for conda.) Because even though it says it is installed, it seems all the items have not propagated throughout. Or something is interferring.

---

<div class="post-metadata">

**Author:** ![jpark](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jpark/32/16574_2.png) [@jpark](https://discourse.jupyter.org/u/jpark)\
**Post date:** [January 18, 2025, 9:53am UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/8 "2025-01-18T09:53:13Z")

</div>

This is perhaps related to Java script. Testing Java Script at the debug console seems fine. For example in the debugger console:

```java
alert('Alert')

```

pops up the box:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/3X/0/f/0f0db7cbe97589dd8409eed4572713020683bcc5.png)

This cell runs fine:

```python
import ipywidgets as widgets
from IPython.display import display

```

When execute this in following cell:

```python
w = widgets.IntSlider()

```

The browser inspect shows:

```auto
Exception opening new comm 3 default.js:1124:20
    _handleCommOpen default.js:1124
    _handleMessage default.js:1286
    _msgChain default.js:179
    (Async: promise callback)
    _onWSMessage default.js:176

```

Which is this code in default.js

```java
    /**
     * Handle a `comm_open` kernel message.
     */
    async _handleCommOpen(msg) {
        this._assertCurrentMessage(msg);
        const content = msg.content;
        const comm = new comm_1.CommHandler(content.target_name, content.comm_id, this, () => {
            this._unregisterComm(content.comm_id);
        });
        this._comms.set(content.comm_id, comm);
        try {
            const target = await Private.loadObject(content.target_name, content.target_module, this._targetRegistry);
            await target(comm, msg);
        }
        catch (e) {
            // Close the comm asynchronously. We cannot block message processing on
            // kernel messages to wait for another kernel message.
            comm.close();
            console.error('Exception opening new comm');
            throw e;
        }
    }

```

Installed :

```auto
> jupyter --version
Selected Jupyter core packages...
IPython : 8.31.0
ipykernel : 6.29.5
ipywidgets : 8.1.5
jupyter_client : 8.6.3
jupyter_core : 5.7.2
jupyter_server : 2.15.0
jupyterlab : 4.3.4
nbclient : 0.10.2
nbconvert : 7.16.5
nbformat : 5.10.4
notebook : not installed
qtconsole : 5.6.1
traitlets : 5.14.3

```

```auto
> lsb_release -a && uname -a
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm
Linux xxx 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux

> firefox --version
Mozilla Firefox 128.5.0esr

```

---

<div class="post-metadata">

**Author:** ![jpark](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jpark/32/16574_2.png) [@jpark](https://discourse.jupyter.org/u/jpark)\
**Post date:** [February 1, 2025, 11:39am UTC](https://discourse.jupyter.org/t/widgets-fail-to-render-debian-12-j-lab-4-3/31264/9 "2025-02-01T11:39:39Z")

</div>

As a workaround installing in venv allows widgets to display. It isn’t obvious in my limited knowledge how this gets around Java Script errors when installed outside a venv.

Thanks to @fomightez for the feedback and ideas.

```auto
jupyter --version
Selected Jupyter core packages...
IPython : 8.31.0
ipykernel : 6.29.5
ipywidgets : 8.1.5
jupyter_client : 8.6.3
jupyter_core : 5.7.2
jupyter_server : 2.15.0
jupyterlab : 4.3.5
nbclient : 0.10.2
nbconvert : 7.16.6
nbformat : 5.10.4
notebook : not installed
qtconsole : 5.6.1
traitlets : 5.14.3
 
python --version
Python 3.13.1

```
