jupyter-ui icon indicating copy to clipboard operation
jupyter-ui copied to clipboard

Can't select different kernel

Open jaydeanmartin opened this issue 2 years ago • 4 comments

First, thank you for all your time and effort. This is a great project.

I have installed a second kernel into my Jupyter(lab?) (sysml). I would like to use this one to parse cell contents instead of the default "python".

If I create a Jupyter widget using:

<Jupyter startDefaultKernel={true} terminals={false} defaultKernelName='sysml'>

.... put in a Cell widget here

</Jupyter>

it keeps using the default "python" kernel. I have not been able to find a good way to set and get the kernel being used. Can this be on a per cell basis or is there a broader context that will use the same kernel depending on how widgets are wrapped with "Jupyter"?

Thank you again

jaydeanmartin avatar Jun 01 '23 15:06 jaydeanmartin

Thx for your interest and kind words.

I have tested a Cell with your config with latest main and it works as expected (the given default kernel name is used). I have just cut a new release 0.4.1, could you try with that version?

echarles avatar Jun 02 '23 06:06 echarles

I installed 0.4.1 and experience the same issue. It always wants to connect to the default kernel. I checked and I have a python3 and a sysml kernel installed. I have also tried to use:

<Jupyter collaborative={true} terminals={false}>

and then use

const {kernelManager} = useJupyter();
const kernel = useMemo(() => {
  if (kernelManager)
    return new Kernel({kernelManager, kernelName: 'sysml'});
  ), [kernelManager]);

when I load the cell to try to force it to use the sysml, but after thinking about the logic in the code snippet (copied form your examples), it seems is loaded only if one isn't already loaded, and the first widget probably loads the default kernel.

As a final experiment, I changed:

<Jupyter defaultKernelName='sysml' collaborative={true} terminals={false}>

and this DOES appear to work. It does connect to the sysml kernel now. Thank you for you assistance. I will need more help - but will put it in another ticket.

jaydeanmartin avatar Jun 02 '23 14:06 jaydeanmartin

That is great news. Kernel connection and management is a whole area and more work needs to be done to have better control. Happy that you are unblocked.

echarles avatar Jun 02 '23 15:06 echarles