Home

Interacting with the Kernel for Python Programming

|
|  Updated:  
2018-02-28 13:25:41
Python Essentials For Dummies
Explore Book
Buy On Amazon
The kernel is the server that enables Python programmers to run cells within Notebook. You typically see the kernel commands in a separate command or terminal window.

kernel Python programming The kernel displays its commands in a separate Jupyter Notebook window.

Each entry shows the time the kernel executed the task, which application the command executed, the task it performed, and any resources affected. In most cases, you don’t need to do anything with this window, but viewing it can be helpful when you run into problems because you often see error messages that can help you resolve an issue.

You control the kernel in a number of ways. For example, saving a file issues a command to the kernel, which carries the task out for you. However, you also find some kernel-specific commands on the Kernel menu, which are described in the following list:

  • Interrupt: Causes the kernel to stop performing the current task without actually shutting the kernel down. You can use this option when you want to do something like stop processing a large dataset.
  • Restart: Stops the kernel and starts it again. This option causes you to lose all the variable data. However, in some cases, this is precisely what you need to do when the environment has become dirty with old data.
  • Restart & Clear Output: Stops the kernel, starts it again, and clears all the existing cell outputs.
  • Restart & Run All: Stops the kernel, starts it again, and then runs every cell starting from the top cell and ending with the last cell. When Notebook reaches the bottom, it selects the last cell but doesn’t insert a new one.
  • Reconnect: Recreates the connection to the kernel. In some cases, environmental or other issues could cause the application to lose its connection, so you use this option to reestablish the connection without loss of variable data.
  • Shutdown: Shuts the kernel down. You may perform this step in preparation for using a different kernel.
  • Change Kernel: Selects a different kernel from the list of kernels you have installed. For example, you may want to test an application using various Python versions to ensure that it runs on all of them.

About This Article

This article is from the book: 

About the book author:

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.