default kernel in Jupyter notebooks

291 views
Skip to first unread message

Ivica Nakić

unread,
Feb 28, 2016, 7:35:22 AM2/28/16
to sage-cloud
Hi!

How complicated would be to add the possibility to configure the default kernel in Jupyter notebooks in project settings?


Ivica


Harald Schilly

unread,
Feb 28, 2016, 7:49:23 AM2/28/16
to sage-...@googlegroups.com
Hi, if this setting applies only to newly created notebooks, then it's
not hard. I.e. instead of using a static template, you want to have a
dynamic template where a value it set on creation.

The only thing that makes this hard, is that it is very brittle. The
existing set of kernels needs to be read to end up in the UI as a
selection, or, one has to think about what happens if a kernel is
renamed or deleted (?), etc.

We can make a feature request ticket for this.

-- h
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/83189a3a-e199-43f6-b7b9-a58d4edd5e0c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ivica Nakić

unread,
Feb 28, 2016, 9:53:11 AM2/28/16
to sage-cloud
Yes, I meant only for new notebooks.

It looks like jupyter notebook populates the kernel list simply by reading directories in the appropriate place.
In Sagemath cloud case this seems to be /usr/local/share/jupyter/kernels.
So the UI would just need to be populated with the values of display_name from kernel.js for each directory in /usr/local/share/jupyter/kernels
Then the next step would be to set the variable MultiKernelManager.default_kernel_name to the name of the chosen kernel 
(which is the name of the corresponding directory) in the file ~/.jupyter/jupyter_notebook_config.py.
To take care of the renamed/deleted kernels, one option would be to check jupyter_notebook_config.py file when starting the project and
if the default kernel does not exists, simply delete the corresponding line from jupyter_notebook_config.py so that Jupyter falls back to the
use of system-wide default kernel.

Ivica

Ivica Nakić

unread,
Feb 28, 2016, 10:18:11 AM2/28/16
to sage-cloud
In Sagemath cloud all Jupyter kernels are listed in /usr/local/share/jupyter/kernels/ except SageMath 6.10,
so perhaps the setting is a little bit more complicated than I thought.

Ivica

Harald Schilly

unread,
Feb 28, 2016, 1:25:09 PM2/28/16
to sage-...@googlegroups.com
I've made this a ticket, with your insightful description:

https://github.com/sagemathinc/smc/issues/441

-- harald
Reply all
Reply to author
Forward
0 new messages