How to List All Installed Jupyter Kernels?

As a data scientist or software engineer, working with Jupyter notebooks is an essential part of your workflow. Jupyter notebooks allow you to create and share interactive code snippets, visualizations, and presentations. One of the most useful features of Jupyter notebooks is the ability to use different kernels to execute code in different programming languages. In this article, we will show you how to list all installed Jupyter kernels.

As a data scientist or software engineer, working with Jupyter notebooks is an essential part of your workflow. Jupyter notebooks allow you to create and share interactive code snippets, visualizations, and presentations. One of the most useful features of Jupyter notebooks is the ability to use different kernels to execute code in different programming languages. In this article, we will show you how to list all installed Jupyter kernels.

Table of Contents

  1. Introduction
  2. What are Jupyter Kernels?
  3. How to List All Installed Jupyter Kernels?
    1. Listing Installed Kernels
  4. How to Install a New Jupyter Kernel?
    1. Installing Kernel Dependencies
    2. Registering the Kernel with Jupyter
    3. Re-listing Installed Kernels
  5. Conclusion

What are Jupyter Kernels?

A Jupyter kernel is a program that executes code in a specific programming language and communicates with the Jupyter notebook interface. The Jupyter notebook interface provides a frontend for the user to interact with the kernel, send code to the kernel for execution, and receive the output produced by the kernel. Each kernel provides a unique execution environment, allowing you to work with different programming languages, libraries, and versions.

How to List All Installed Jupyter Kernels?

To list all installed Jupyter kernels, you can use the jupyter kernelspec list command in your terminal or command prompt. This command lists all the installed kernels on your system, along with their installation paths.

jupyter kernelspec list

The output of this command will look something like this:

Available kernels:
  python3    /usr/local/share/jupyter/kernels/python3
  R          /usr/local/share/jupyter/kernels/ir
  scala      /usr/local/share/jupyter/kernels/apache_toree_scala

This output shows that there are three kernels installed on the system: python3, R, and scala. The second column shows the installation path for each kernel.

How to Install a New Jupyter Kernel?

To install a new Jupyter kernel, you need to first install the kernel’s dependencies and then register the kernel with Jupyter. For example, to install a new kernel for the Julia programming language, you can use the following commands:

# Install Julia dependencies
sudo apt-get install julia
julia
# In Julia REPL
using Pkg
Pkg.add("IJulia")
# Register Julia kernel with Jupyter
python -m ipykernel install --user --name julia --display-name "Julia"

The first set of commands installs the Julia dependencies, and the second set of commands registers the Julia kernel with Jupyter. The --user flag specifies that the kernel should be installed for the current user only, and the --name flag specifies the name of the kernel. The --display-name flag specifies the name that will be displayed in the Jupyter notebook interface.

To reaffirm the installation of the new Julia kernel, let’s list all installed Jupyter kernels one more time:

jupyter kernelspec list

The output will now include the Julia kernel:

Available kernels:
  python3    /usr/local/share/jupyter/kernels/python3
  R          /usr/local/share/jupyter/kernels/ir
  scala      /usr/local/share/jupyter/kernels/apache_toree_scala
  julia      /home/user/.local/share/jupyter/kernels/julia

This final listing confirms the successful installation of the Julia kernel alongside the previously mentioned kernels. Armed with the ability to manage and install Jupyter kernels, you can tailor your environment to the specific requirements of diverse programming languages, empowering your work with Jupyter notebooks.

Conclusion

In this article, we have shown you how to list all installed Jupyter kernels using the jupyter kernelspec list command. We have also explained what Jupyter kernels are and how they provide a unique execution environment for different programming languages. Finally, we have shown you how to install a new Jupyter kernel for a specific programming language.

Knowing how to list all installed Jupyter kernels is an essential skill for data scientists and software engineers working with Jupyter notebooks. By understanding the different kernels available to you, you can choose the best environment for your specific needs and work with a wide range of programming languages.


About Saturn Cloud

Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Request a demo today to learn more.