4

I started a jupyterhub server with jupyterlab interface, and create some kernels for different language.
Is it possible to change the logo image of kernel in jupyterlab Launcher, for example, the ''M'' logo in the picture.

The followings are the kernel info:

$ jupyter kernelspec list
Available kernels:
  python3              /usr/local/anaconda3/envs/Server/share/jupyter/kernels/python3
  matlab               /usr/local/share/jupyter/kernels/matlab
  quantum              /usr/local/share/jupyter/kernels/quantum
  wolframlanguage12    /usr/local/share/jupyter/kernels/wolframlanguage12

I found out that there exist a logo image logo-64x64.png in /usr/local/anaconda3/envs/Server/share/jupyter/kernels/python3.

But if I download other png file, resize it to 64x64, rename it as logo-64x64.png, and put it under /usr/local/share/jupyter/kernels/matlab/, the logo display on launcher will become python's logo, in stead of the image I downloaded.

The kernel.json file in /usr/local/share/jupyter/kernels/matlab :

{
    "argv": [
        "/usr/local/anaconda3/envs/Py35/bin/python", "-m", "matlab_kernel", "-f", "{connection_file}"],
    "display_name": "Matlab",
    "language": "matlab",
    "mimetype": "text/x-octave",
    "name": "matlab"
}

Did I miss-understand something, or should I put the logo image in other position.

1 Answers1

-1

This question falls under the topic of changing the name of a kernel. There are two ways to modify the display of a kernel in Jupyter. One way is manually changing the config file, the other way is properly registering changes.

Manually changing the name of the kernel is not a good idea. If you later upgrade the Jupyter Lab package using pip, then the updated Jupyter Lab will not find that R kernel you renamed. But if you do want to manually rename a R kernel, then the config file is usually found in the following location. The config file is named, kernel.json, and this file can be opened and edited with a Notepad or similar text editor. Also within this same folder is a separate logo file - logo.png. This is where the standard and non standard logo could potentially be changed (Non Anaconda User)

Note: Using Anaconda puts an unknown factor into everything that's done and this is why most advanced users don't use Anaconda. Most advanced users prefer to control exactly what is happening, when, and why. If I were to guess, I'd guess Anaconda cannot find any file you've manually modified.

C:\Users\prior\AppData\Roaming\jupyter\kernels

Just change the value in the display name in, kernel.json. I changed it from R to R 3.6.

{
      "argv": ["C:/PROGRA~1/R/R-36~1.0/bin/x64/R", "--slave", "-e", 
      "IRkernel::main()", "--args", "{connection_file}"],
      "display_name": "R3.6",
      "language": "R"
    }

There is a correct way to rename a kernel. You can install kernels for one or multiple versions of R to be used in Juypter Lab or Notebook. Then just supply a name and display name argument to the installspec() fct.

After installing the R version 3.6 and 3.5 kernels, then do the following in the R Console.

# Generic - To name a kernel
IRkernel::installspec()  # to register the name of a the kernel 

# To name the R 3.6 kernel 
IRkernel::installspec(name = 'ir33', displayname = 'R 3.6') # Need only one time !! 

# To name the R 3.5 kernel 
IRkernel::installspec(name = 'ir35', displayname = 'R 3.5')  # name the new 3.5 kernel

I cannot test this because I do not use Anaconda, but this might work even for those users who choose to use Anaconda. But there does not appear to be any option to change the display logo using this function.

I manually renamed the python kernels in Jupyter Lab config file using same process described above, but those python configuration files were located in a python folder elsewhere on the PC.

Gray
  • 1,164
  • 1
  • 9
  • 23