PyCharm 2023.2 Help

Jupyter notebook support

With Jupyter Notebook integration available in PyCharm , you can easily edit, execute, and debug notebook source code and examine execution outputs including stream data, images, and other media.

Notebook support in PyCharm includes:

Quick start with the Jupyter notebook in PyCharm

To start working with Jupyter notebooks in PyCharm:

  1. Create a new Python project, specify a virtual environment, and install the jupyter package.

  2. Open or create an .ipynb file.

  3. Add and edit source cells.

  4. Execute any of the code cells to launch the Jupyter server.

Get familiar with the user interface

Mind the following user interface features when working with Jupyter notebooks in PyCharm.

Notebook editor

Overview of the editor UI

A Jupyter notebook opened in the editor has its specific UI elements:

  • Jupyter notebook toolbar: provides quick access to the most popular actions. The rest of the notebook-specific actions are available in the Cell menu.

  • Code cell: a notebook cell that contains an executable code

  • Cell output: results of the code cell execution; can be presented by a text output, table, or plot.

  • Cell toolbar: a toolbar of the code cell with the most popular commands. By default, cell toolbars are disabled. To enable them, open project Settings (Control+Alt+S), go to Languages & Frameworks | Jupyter, and select the Show cell toolbar checkbox.

Cell toolbar

Each code cell has its configurable toolbar so that you can easily access the most popular commands and actions. By default, cell toolbars are disabled. To enable them, open project Settings (Control+Alt+S), go to Languages & Frameworks | Jupyter, and select the Show cell toolbar checkbox.

Toolbar element

Description

Run cell

Executes the code cell. You can also press Control Enter to run the code cell.

Run cell and select below

Executes this cell and select the cell below. Press Shift+Enter to call the same action.

Move cell up

Moves the current cell up.

Move cell down

Moves the current cell down.

Delete Cell

Deletes the current cell.

More options

Open the list of additional call actions:

  • Run all above: Executes all cells that preceded the selected cell.

  • Debug cell: Runs the Debugger for the current cell. You should set the breakpoint first. Click the gutter next the line to want to stop at.

  • Merge Cell Above: Merges the current cell with the cell above.

  • Merge Cell Below: Merges the current cell with the cell below.

  • Split Cell: Splits the current cell by the selected code line.

  • Convert Cell to Code: Converts the current cell into a code cell.

  • Convert Cell to Markdown: Converts the current cell into a Markdown cell.

Notebook toolbar

The Jupyter notebook toolbar provides quick access to all basic operations with notebooks:

Jupyter toolbar

Toolbar element

Description

new cell

Adds a code cell below the selected cell.

Cut

Moves the selected item or items from the current location to the clipboard. Moves the entire cell if it's selected.

Copy

Copies the selected item or items to the clipboard. Copies the entire cell if it's selected.

Paste

Inserts the contents of the clipboard into the selected location. If you've selected an entire cell, the contents are pasted to a new cell below the selected one.

Move cell up

Moves the current cell up.

Move cell down

Moves the current cell down.

Run cell

Executes this cell and selects a cell below. If there is no a cell below, PyCharm will create it.

Debug cell

Starts debugging for this cell.

Interrupt kernel

Click this icon if you want to interrupt any cell execution.

Restart the kernel

Click this icon to restart the currently running kernel.

Run all cells

Executes all cells in the notebook.

Cell type

You can select a cell type from this list and change the type for the selected cell.

remove the cell

Deletes the current cell.

List of Jupyter servers

The Jupyter Server widget that shows the currently used Jupyter server. Click the widget and select Configure Jupyter Server to setup another local or remote Jupyter server.

List of Jupyter kernels

List of the available Jupyter kernels.

Trusted JS widgets

Select this checkbox to allow executing JavaScript in your Jupyter notebook.

Select cell above

This actions selects the cell above.

Select cell below

This actions selects the cell blow.

Open notebook in browser

You can preview the notebook in a browser.

Tool windows

The Server Log tab of the Jupyter tool window appears when you have any of the Jupyter server launched. The Server log tab of this window shows the current state of the Jupyter server and the link to the notebook in a browser.

Jupyter server tool window: the Server log tab

It also provides controls to stop the running server (Stop the server) and launch the stopped server (Run the server).

The Jupyter Variables tool window the detailed report about variable values of the executed cell.

Jupyter server tool window: the Variables tab

You can use the Settings icon to manage the variables loading policy.

Last modified: 01 September 2023