Skip to content

CustomerJupyterKernel

William Stein edited this page Dec 12, 2017 · 5 revisions

I would like to create my own custom Jupyter kernel

In the example

Create a Terminal via +New -> Terminal.

  1. Get a list of the currently installed kernels as follows:
/usr/local/share$ jupyter kernelspec list
Available kernels:
  anaconda3         /ext/jupyter/kernels/anaconda3
  bash              /ext/jupyter/kernels/bash
  calysto_prolog    /ext/jupyter/kernels/calysto_prolog
  gap               /ext/jupyter/kernels/gap
  ir                /ext/jupyter/kernels/ir
  ir-sage           /ext/jupyter/kernels/ir-sage
  julia             /ext/jupyter/kernels/julia
  octave            /ext/jupyter/kernels/octave
  pari_jupyter      /ext/jupyter/kernels/pari_jupyter
  postgres          /ext/jupyter/kernels/postgres
  python2           /ext/jupyter/kernels/python2
  python2-ubuntu    /ext/jupyter/kernels/python2-ubuntu
  python3           /ext/jupyter/kernels/python3
  sage-7.6          /ext/jupyter/kernels/sage-7.6
  sage-8.0          /ext/jupyter/kernels/sage-8.0
  sage-8.1          /ext/jupyter/kernels/sage-8.1
  sage-develop      /ext/jupyter/kernels/sage-develop
  sagemath          /ext/jupyter/kernels/sagemath
  scala211          /ext/jupyter/kernels/scala211
  singular          /ext/jupyter/kernels/singular
  vpython           /ext/jupyter/kernels/vpython
  1. Copy one of the above over that is closest to the kernel you want to create, e.g.,
cp -arv /ext/jupyter/kernels/sage-8.1 /home/user/.local/share/jupyter/kernels/sage_custom
  1. Edit the kernel.json file copy of the kernel you made.
cd /home/user/.local/share/jupyter/kernels/sage_custom
open kernel.json

Make sure to change the name of the kernel, etc. E.g., you might change kernel.json to:

{
 "display_name": "sage_custom",
 "argv": ["/home/user/sage/sage", "--python", "-m", "sage.repl.ipython_kernel", "--matplotlib=inline", "-f", "{connection_file}"]
}
  1. Test your kernel in the terminal first to more easily see what is wrong (if anything):
~/.local/share/jupyter/kernels/sage_custom$ jupyter console --kernel=sage_custom
  1. Once you have your kernel working in a terminal, test your kernel from a Jupyter notebook.

You should probably restart your project to ensure that everything is configured properly, then just try to select your new kernel from the menu.

Clone this wiki locally