Remove environments from the Jupyter Lab Launcher

These entries correspond to kernelspecs which contain the metadata corresponding to the kernel that is invoked within given notebook or console. One way to manage which kernelspecs are avaible is via a kernelspec whitelist. Another way is to remove the unwanted kernelspecs from your system. Since that may impact others, here’s how to go about the former…

  1. From the same environment in which juptyer lab is invoked, run the following: jupyter kernelspec list
    This will produce a list of kernel and directory names containing kernelspec definitions. What you see in Notebook/Lab are the display name values located in the kernel.json file within each of these directories. However, the whitelist is built using the name from the first column of each of the entries - which essentially corresponds to the lowercased basename of the second column.
  2. Locate the entries you’d like to make available. The first and fifth entries will likely correspond to python3 and ir respectively. Not sure how the name of the third entry will be manifested in the output but you should be able to infer from the directory name of the 3 that remain.
  3. Assuming the third entry is mycondapythonkernel, add it along with the others to your whitelist. This can be done from the command line using --KernelSpecManager.whitelist="['python3','ir','mycondapythonkernel']" or via the configuration file with an entry c.KernelSpecManager.whitelist = set(['python3','ir','mycondapythonkernel']). The order in the list doesn’t affect their display in Lab.
  4. Restart Lab and only the 3 kernelspecs should be displayed.
3 Likes