Jupyverse connection to IPKernelApp within Qt/PySide app

Hello all,

I was able to get both integrated and normal QtConsole example from here https://github.com/ipython/ipykernel/tree/main/examples/embedding running but I struggling to connect a notebook interface to an already running kernel inside a PySide app.
From what I found the “simplest” way should be with jupyverse but I’m still unable to find my kernel from jupyterlab.
Once my PySide app launched I get a json file in $HOME/.local/share/jupyter/runtime, the one I use to connect a QtConsole. I start jupyverse with:
jupyverse --set "kernels.allow_external_kernels=true" --set "kernels.external_connection_dir=/home/jeandet/.local/share/jupyter/runtime" --set "auth.mode=noauth" --port=8800 --open-browser

From the browser I can’t see any running kernel, I sometimes get from the terminal (maybe related):

  File "/home/jeandet/PySide6.5.1Venv3.10/lib/python3.10/site-packages/fps_kernels/routes.py", line 154, in get_sessions
    kernel_id = session.kernel.id
AttributeError: 'dict' object has no attribute 'id'

Is there anything obvious I missed or I can do to fix/understand the issue? Any help is welcome :slight_smile: .

Best regards,
Alexis.

Hi @jeandet

did you ever resolve this? I’m attempting to do something similar with jupyverse. It’s not clear to me whether it is even reading the connection.json file I made.

Regards
Baldur

Hi @Baldur_van_Lew,
I gave up with jupyverse and used the pyxll-jupyter solution SciQLop/SciQLop/Jupyter at c494c95b641e391b120224f5bf9621c0412d75ab · SciQLop/SciQLop · GitHub the main trick here is that you must define entry-points then after I use this to spawn jupterlab:
SciQLop/SciQLop/backend/jupyter_clients/jupyterlab.py at c494c95b641e391b120224f5bf9621c0412d75ab · SciQLop/SciQLop · GitHub. It’s still full of edge cases, specially PySide and IPykernel doesn’t play well together mainly because of the event loop.
I wish you good luck with your project :).

Many thanks @jeandet !

I’ll probably go with a similar solution. I’ve also opened a new issue in Github on this.