jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
14.13k stars 3.36k forks source link

Show errors from kernel restart in the user interface #16835

Open bluss opened 1 week ago

bluss commented 1 week ago

Problem

When there is a problem (exception) at kernel restart - using a local kernel provisioner, show this error to the user in jupyterlab.

Using a custom local kernel provisioner, it can raise exceptions during pre_launch and launch_kernel, and jupyterlab will show these errors to the user - very good.

Current behaviour: If there is an exception at kernel restart - using launch_kernel again, these exceptions are only visible in the log and not shown to the user.

The problem could be something like that the kernel's python environment has changed and a required dependency is no longer available (probably due to some user error, so it would just be nice to tell the user about this so they can fix it).

Proposed Solution

Record exceptions when restarting kernel and show the first error encountered in kernel restart to the user, using the same user interface as for errors during first kernel start.

Additional context

It's a local kernel provisioner that sets up a Python ipykernel environment using uv and a project configuration.

This error box (below) already exists for first kernel start. Let's re-use it for errors on kernel restart.

bild

JasonWeill commented 6 days ago

Related issue: #8738 (UI for when the kernel fails)