Repository navigation
ipykernel 7.0.0 release with subshells #1438
Description
Kernel Subshells in ipykernel 7.0.0
This is a placeholder issue for the ipykernel 7.0.0 release which includes kernel subshells for the first time in a full release, and is due for release on Monday 13th October 2025. This is intended to be the first point of call to obtain information about the release, ask questions and report problems with it.
For those not using subshells it is supposed to be backward compatible with the 6.x branch, but there are some architectural changes such as the use of a separate thread to handle sending and receiving of shell channel messages which may break assumptions made in downstream libraries and hence this is identified as a major releases as it is potentially backwards incompatible. If you experience problems then please report them, and you can pin ipykernel < 7 if necessary.
There have been many discussions, issues and pull requests about subshells over the last few years. Linking to all of these would be overwhelming, so here are a few salient links only. Searching in the ipykernel github repo for "subshells" will give more links.
The original motivation and changes to the Jupyter protocol are in Jupyter Enhancement Proposal 91.
The history in ipykernel is complicated by the original implementation being included with changes from tornado to anyio, but the anyio changes have since been sidelined and the second subshell implementation in the current 7.x branch is on top of tornado. Version numbers in related issues and PRs are therefore not always correct.
ipykernel
- Original implementation in PR Kernel subshells (JEP91) implementation #1249, this has a useful diagram and a list of future changes, such as to execution counts, that need to be made.
- Current implementation in PR Subshells implemented using tornado event loops on 6.x branch #1396.
- Details of branch manipulations in Subshells on 6.x branch #1387 and Ipykernel releases and branches #1399.
jupyterlab
- Subshell support added in Support kernel subshells jupyterlab/jupyterlab#16963. This includes a video and explanation of how you can use subshells in kernels that support them.
- Support for comms over subshells added in If subshells are supported by the kernel, send comm messages to subshells jupyterlab/jupyterlab#17363 and Sort the list of plugins and tokens in the documentation jupyterlab/jupyterlab#17364, including some useful videos. This fixes a problem in
ipywidgets(and hence other widget libraries) of widgets not updating whilst the kernel shell is performing a blocking operation.
ipympl
ipympl 0.9.8includes Use thread lock to support comms via subshells matplotlib/ipympl#603 to support comms over subshells.
Future work
There is future work to be done supporting the ipykernel 7.0.0 release in downstream projects, and in addressing various issues that need to work with subshells such as those enumerated in the first post of #1249.
Activity
ianthomas23 commentedon Oct 13, 2025
ipykernel 7.0.0released: https://github.com/ipython/ipykernel/releases/tag/v7.0.0.bollwyvl commentedon Oct 13, 2025
on conda-forge, with known test failures on python 3.14 vs windows:
krassowski commentedon Oct 14, 2025
ianthomas23 commentedon Oct 14, 2025
Ipykernel 7.0.0 was indeed broken on Python 3.14, this is now fixed in release 7.0.1 (as far as I aware).
faultdiagnosistoolbox commentedon Oct 14, 2025
I encounter problems with matplotlib backends (all I've tried) where the problems seems to be caused by the new version of ipykernel.
How to excite the problem on my machine:
Starting a
jupyter consoleand
running the code
causes a crash with ipykernel v 7.0.0 or 7.0.1.
Downgrading matplotlib and other packages does not fix the problem. If I downgrade ipykernel to 6.30.1 it works as expected.
OS: MacOS
Python: 3.12 and 3.13
dfalbel commentedon Oct 14, 2025
We have a maybe special use case where we launch IPyKernel from a background thread, eg:
This of coursebreaks the assumption in:
ipykernel/ipykernel/subshell_manager.py
Line 44 in f14b95b
I wonder if it would be possible to
main_thread()to actually refer to the actual launching thread.minrk commentedon Oct 15, 2025
It should be, we just need to make sure to carry the reference around in the right places.
pin ipykernel <7.0, bump to python >=3.10 and napari >=0.6 (#50)
dfalbel commentedon Oct 15, 2025
@minrk Indeed, this works for me. I have a local proof of concept. Happy to submit a patch if you think its worth it.
ianthomas23 commentedon Oct 15, 2025
Yes please, a patch would be good. Please include a test also.
simonkeys commentedon Nov 19, 2025
I found a problem that occurs with ipykernel 7.0 but not with 6.31.
pyqtgraph has a feature that uses jupyter_rfb to display Qt graphics (I'm using PySide6) in Jupyter Lab. Somewhere in this process there is an issue with calls to different threads:
The error occurs when mousing over the generated widget.
I'm not sure which of these projects I should report the issue to...
Code is
I'm using
ianthomas23 commentedon Nov 19, 2025
@simonkeys Thanks for reporting.
With
ipykernel >= 7andjupyterlab >= 4.4.4thenipywidgets(the base package thatpyqtgraph.GraphicsLayoutWidgetandjupyter_rfb.RemoteFrameBufferuse) uses subshells forcomms, which means that the callback code used to update the widget to show the graphics is running in a separate thread, not the main thread, by default. This is strictly prohibited by windowing toolkits such asQtas the error message indicates.To progress, you can disable the use of "Kernel comms over subshells" in the JupyterLab Settings Editor, change it to "Disabled" in the screenshot below:
Longer term, how could this situation be improved? Probably the simplest and quickest fix would be for
pyqtgraphto check what thread is running the widget callback code, and if it is not the main Qt thread to signal that thread to run the update instead. Then Qt will be happy.There is an alternative of allowing individual comms to override the JupyterLab setting and not use subshells. But the plumbing for that through
ipywidgetsandjupyterlabisn't simple, and it would require changes inpyqtgraph/jupyter_rfbanyway.