# Run and debug Jupyter notebook code cells

> **Warning:**
> The following is only valid when the Python and Jupyter plugins are [installed and enabled](managing-plugins.html)!

You can execute the code of notebook cells in many ways using the icons on the notebook toolbar, commands in the code cell context menu and in the Structure tool window, and the Run  icon in the gutter.

> **Note:**
> When you work with local notebooks, you don’t need to launch any Jupyter server in advance: execute any cell, and the server will be launched.

## Run code cells

Procedure: Run code cells using shortcuts and toolbar options

* Use the following smart shortcuts to quickly run the code cells:

* `Ctrl+Enter` (Windows), `Ctrl+Enter` (macOS), `Ctrl+Enter` (IntelliJ IDEA Classic (macOS)), `Ctrl+Enter` (macOS System Shortcuts), `Ctrl+Enter` (XWin), `Ctrl+Enter` (GNOME), `Ctrl+Enter` (KDE), `Ctrl+Enter` (Emacs), `Ctrl+Enter` (Sublime Text), `Ctrl+Enter` (Sublime Text (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Visual Studio), `Ctrl+Enter` (Visual Studio (macOS)), `Ctrl+Enter` (Eclipse), `Ctrl+Enter` (Eclipse (macOS)): Runs the current cell.

* `Shift+Enter` (Windows), `Shift+Enter` (macOS), `Shift+Enter` (IntelliJ IDEA Classic (macOS)), `Shift+Enter` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `Shift+Enter` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `Shift+Enter` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `Shift+Enter` (Eclipse (macOS)): Runs the current cell and selects the cell below it.

> **Note:**
> When executing one cell at a time, mind code dependencies. If a cell relies on some code in another cell, that cell should be executed first.

When the execution is done, the cell remains in the edit mode so that you can modify it, if needed, and keep experimenting.

Press `Ctrl+Home` (Windows), `⌘ Home` (macOS), `⌘ Home` (IntelliJ IDEA Classic (macOS)), `⌘ ↑` (macOS System Shortcuts), `Ctrl+Home` (XWin), `Ctrl+Home` (GNOME), `Ctrl+Home` (KDE), `Ctrl+Home` (Emacs), `Ctrl+Home` (Sublime Text), `⌘ ↑` (Sublime Text (macOS)), `Ctrl+Home` (NetBeans), `Ctrl+Home` (Visual Studio), `⌘ Home` (Visual Studio (macOS)), `Ctrl+Home` (Eclipse), `⌘ Home` (Eclipse (macOS)) to move the caret to the start or `Ctrl+End` (Windows), `⌘ End` (macOS), `⌘ End` (IntelliJ IDEA Classic (macOS)), `⌘ ↓` (macOS System Shortcuts), `Ctrl+End` (XWin), `Ctrl+End` (GNOME), `Ctrl+End` (KDE), `Ctrl+End` (Emacs), `Ctrl+End` (Sublime Text), `⌘ ↓` (Sublime Text (macOS)), `Ctrl+End` (NetBeans), `Ctrl+End` (Visual Studio), `⌘ End` (Visual Studio (macOS)), `Ctrl+End` (Eclipse), `⌘ End` (Eclipse (macOS)) to move the caret to the end of the current cell while in edit mode.

* To execute all code cells in your notebook, click ![Run all](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.actions.runAll.svg) on the [notebook toolbar](jupyter-notebook-support.html#toolbar) .

* Press `Ctrl+Home` (Windows), `⌘ Home` (macOS), `⌘ Home` (IntelliJ IDEA Classic (macOS)), `⌘ ↑` (macOS System Shortcuts), `Ctrl+Home` (XWin), `Ctrl+Home` (GNOME), `Ctrl+Home` (KDE), `Ctrl+Home` (Emacs), `Ctrl+Home` (Sublime Text), `⌘ ↑` (Sublime Text (macOS)), `Ctrl+Home` (NetBeans), `Ctrl+Home` (Visual Studio), `⌘ Home` (Visual Studio (macOS)), `Ctrl+Home` (Eclipse), `⌘ Home` (Eclipse (macOS)) to focus on the fist cell or `Ctrl+End` (Windows), `⌘ End` (macOS), `⌘ End` (IntelliJ IDEA Classic (macOS)), `⌘ ↓` (macOS System Shortcuts), `Ctrl+End` (XWin), `Ctrl+End` (GNOME), `Ctrl+End` (KDE), `Ctrl+End` (Emacs), `Ctrl+End` (Sublime Text), `⌘ ↓` (Sublime Text (macOS)), `Ctrl+End` (NetBeans), `Ctrl+End` (Visual Studio), `⌘ End` (Visual Studio (macOS)), `Ctrl+End` (Eclipse), `⌘ End` (Eclipse (macOS)) to focus on the last cell of your notebook while in command mode.

Procedure: Duration of cell execution

* You can find the information about the duration of a cell execution in the lower left corner of the cell.

Hover over this area to view the date and time when the cell execution was completed.

![The information about the last cell execution](https://resources.jetbrains.com.cn/help/img/idea/2026.2/last_cell_execution_info.png)

In case of any errors, expand the Traceback node to view the complete error message.

![Error traceback](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_ds_error_traceback.png)

When you [stop the server](configuring-jupyter-notebook.html#stop-server) and [change the server or kernel](configuring-jupyter-notebook.html#setup-configured-server), you have to execute all cells with dependencies again because execution results are valid for the current server session only.

## Monitor kernel memory usage

IntelliJ IDEA shows the memory consumption of the active Jupyter kernel. The widget updates in real time while the kernel is running, so you can avoid unexpected computation failures caused by low memory.

To show or hide the widget, click the button in the upper-left corner of the [Jupyter
Variables](#variables) tool window.

![Jupyter Memory Widget](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_jupyter_memory_widget.png)

## View variables

Procedure: Jupyter Console

This functionality is enabled by default for both local and remote kernels. To disable it for remote kernels, go to `Settings | Tools | Jupyter | Jupyter General` and uncheck the Upload support libs to remote Jupyter checkbox.

When you execute your notebook, you can preview variables in the Variables tab of the [Jupyter console](jupyter-notebook-support.html#jupyter-console).

![Jupyter console: the Variables tab](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_jupyter_variable_view.png)

By default, variables are loaded asynchronously. To change the loading policy, click ![Manage the loading policy](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg) in the Variables tab, select Variables Loading Policy, and select one of the available modes:

* Synchronously: variables are loaded all together.

* Asynchronously: variables are loaded separately.

* On demand: variables are loaded on user's request.

You can click View as Array, View as DataFrame, View as Image, or View as Series to display the data in the corresponding tool window. For more information, refer to [Work with outputs](working-with-cell-outputs.html).

Procedure: Jupyter Variables tool window

The Jupyter Variabes tool window will appear each time you execute a cell. If you need to hide it permanently, go to `Settings | Tools | Jupyter | Jupyter General` and uncheck the Show Variables tool window on execution checkbox.

![Jupyter Variables tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_jupyter_variables_tool_window.png)

Procedure: Data Vision

To preview variables right in the editor, go to `Settings | Tools | Jupyter | Jupyter General` and make sure that the Show inline values checkbox is enabled.

1. Run the notebook cell. The values of variables are shown next to their usages:

In entire notebook:

![Inline variables in the source editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_ds_jupyter_inline_variables.png)

In current line:

![Inline variables in the source editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_ds_jupyter_inline_variables_line.png)

2. Click the variable to view detailed information in a popup.

![Preview variables in a popup in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_preview_variable.png)

## Preview reference documentation

With IntelliJ IDEA you can always quickly preview reference documentation for a particular variable, type, or argument.

Procedure:

1. To view reference information for any element of a particular code cell, place the caret within the target code cell and type `? <type/variable/argument>`. (in this example, you will preview documentation for `plt.scatter`). Note that a code element should be accessible within the code cell.

2. [Execute the cell](#execute-cell). The Introspection tab opens in the  Jupyter  tool window.

![Previewing reference documentation for plt.scatter](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_ds_jupyter_introspection.png)

3. Preview reference documentation in the Introspection tab.

> **Note:**
> The Introspection tab shows documentation for the latest requested code element. Even though you proceed with executing other code cells, restart the server, or delete the line with your request, this information will be shown.

## Debug code in Jupyter notebooks

IntelliJ IDEA provides the Jupyter Notebook Debugger for both local and remote Jupyter server kernels.

> **Warning:**
> Debugging is not supported for [Google Colab](null) servers .

Procedure:

PyCharm supports debugging Jupyter notebooks with debugpy and pydevd . By default, PyCharm uses debugpy.

To change the debugger implementation, use the Debugger mode selector in the upper-right corner of the Debug tool window.

> **Tip:**
> The selected debugger mode also determines the Jupyter runtime used for the debugging session. In debugpy mode, all notebook debugging features use debugpy. In pydevd mode, they use pydevd.

![Debugpy dropdown](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_debugpy_dropdown.png)

> **Note:**
> For remote Jupyter sessions, IntelliJ IDEA always uses pydevd and the Debugger mode selector is hidden.

1. Set the [breakpoints](using-breakpoints.html) in the selected cell and click ![Debug Cell](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.debug.svg) `Debug Cell` in the cell toolbar. Alternatively, you can right-click the cell and select `Debug Cell` from the context menu.

The Debug tool window opens.

![Jupyter Notebook Debugger tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_jupyter_debug_start.png)

2. Use the [stepping toolbar](#stepping-toolbar) buttons to choose on which line you want to stop next.

Debugging is performed within a single code cell. However, if your code cell calls a function from any cell that has been already debugged, you can step into it. The related breakpoints will also work. Note that the cell with the function must be debugged, not just executed.

> **Warning:**
> The debugger may skip a cell if you change its source code or execute it not under the debugger. Also, you can see a warning message when trying to modify the cell code during the debugging session.

Similarly, you can step into a function called from a Python file that is located in the same project.

3. Proceed with the debugging steps to complete the execution of the cell.

![Debugging is complete](https://resources.jetbrains.com.cn/help/img/idea/2026.2/py_jupyter_debug_finish.png)

## Stepping actions

| Item | Tooltip and Shortcut | Description |
| --- | --- | --- |
|  Action available on the Debugger toolbar.  |
|  ![Step over](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.stepOver.svg)  |    Step Over      `F8` (Windows), `F8` (macOS), `F8` (IntelliJ IDEA Classic (macOS)), `⌘ Quote` (macOS System Shortcuts), `F8` (XWin), `F8` (GNOME), `F8` (KDE), `F8` (Emacs), `F8` (Sublime Text), `F8` (Sublime Text (macOS)), `F8` (NetBeans), `F10` (Visual Studio), `F10` (Visual Studio (macOS)), `F6` (Eclipse), `F6` (Eclipse (macOS))     | Click this button to execute the program until the next line in the current method or file, skipping the methods referenced at the current execution point (if any). If the current line is the last one in the method, execution steps to the line are executed right after this method.  |
|  ![Step into](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.stepInto.svg)  |    Step Into      `F7` (Windows), `F7` (macOS), `F7` (IntelliJ IDEA Classic (macOS)), `⌘ ;` (macOS System Shortcuts), `F7` (XWin), `F7` (GNOME), `F7` (KDE), `F7` (Emacs), `F7` (Sublime Text), `F7` (Sublime Text (macOS)), `F7` (NetBeans), `F11` (Visual Studio), `⌘ F11` (Visual Studio (macOS)), `F5` (Eclipse), `F5` (Eclipse (macOS))     |     Click this button to have the debugger step into the method called at the current execution point.     |
|  ![Step out](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.stepOut.svg)  |    Step Out      `Shift+F8` (Windows), `⇧ F8` (macOS), `⇧ F8` (IntelliJ IDEA Classic (macOS)), `⌘ \` (macOS System Shortcuts), `Shift+F8` (XWin), `Shift+F8` (GNOME), `Shift+F8` (KDE), `Shift+F8` (Emacs), `Shift+F8` (Sublime Text), `⇧ F8` (Sublime Text (macOS)), `Ctrl+F7` (NetBeans), `Shift+F11` (Visual Studio), `⇧ F11` (Visual Studio (macOS)), `F7` (Eclipse), `F7` (Eclipse (macOS))     | Click this button to have the debugger step out of the current method, to the line executed right after it.  |
|  Additional stepping actions available by clicking ![More stepping actions](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.moreVertical.svg) on the Debugger toolbar.  |
|  ![Force Step Over](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.forceStepOver.svg)  |     Force Step Over       `Alt+Shift+F8` (Windows), `⌥ ⇧ F8` (macOS), `⌥ ⇧ F8` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ Quote` (macOS System Shortcuts), `Alt+Shift+F8` (XWin), `Alt+Shift+F8` (GNOME), `Alt+Shift+F8` (KDE), `Alt+Shift+F8` (Emacs), `Alt+Shift+F8` (Sublime Text), `⌥ ⇧ F8` (Sublime Text (macOS)), `Alt+Shift+F8` (NetBeans), `Alt+Shift+F8` (Visual Studio), `⌥ ⇧ F8` (Visual Studio (macOS)), `Alt+Shift+F8` (Eclipse), `⌘ ⌃ F6` (Eclipse (macOS))     |  Steps over the current line of code and takes you to the next line even if the highlighted line has method calls in it. If there are breakpoints in the called methods, they are ignored.  |
|  ![Force step into](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.forceStepInto.svg)  |    Force Step Into   `Alt+Shift+F7` (Windows), `⌥ ⇧ F7` (macOS), `⌥ ⇧ F7` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ ;` (macOS System Shortcuts), `Alt+Shift+F7` (XWin), `Alt+Shift+F7` (GNOME), `Alt+Shift+F7` (KDE), `Alt+Shift+F7` (Emacs), `Alt+Shift+F7` (Sublime Text), `⌥ ⇧ F7` (Sublime Text (macOS)), `Alt+Shift+F7` (NetBeans), `Alt+F11` (Visual Studio), `⌥ F11` (Visual Studio (macOS)), `Alt+Shift+F7` (Eclipse), `⌘ ⌃ F5` (Eclipse (macOS))  | Click this button to have the debugger step into the method called in the current execution point even if this method is to be skipped.  |
|  ![Smart Step Into](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.smartStepInto.svg)  |    Smart Step Into   `Shift+F7` (Windows), `⇧ F7` (macOS), `⇧ F7` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ;` (macOS System Shortcuts), `Shift+F7` (XWin), `Shift+F7` (GNOME), `Shift+F7` (KDE), `Shift+F7` (Emacs), `Shift+F7` (Sublime Text), `⇧ F7` (Sublime Text (macOS)), `Shift+F7` (NetBeans), `Shift+F7` (Visual Studio), `⇧ F7` (Visual Studio (macOS)), `Ctrl+F5` (Eclipse), `⌥ F5` (Eclipse (macOS))  |  Smart step into is helpful when there are several method calls on a line, and you want to be specific about which method to enter. This feature allows you to select the method call you are interested in.  |
|  ![Run to cursor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.runToCursor.svg)  |    Run to Cursor      `Alt+F9` (Windows), `⌥ F9` (macOS), `⌥ F9` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ \` (macOS System Shortcuts), `Alt+Shift+9` (XWin), `Alt+Shift+9` (GNOME), `Alt+Shift+9` (KDE), `Alt+F9` (Emacs), `Alt+F9` (Sublime Text), `⌥ F9` (Sublime Text (macOS)), `F4` (NetBeans), `Ctrl+F10` (Visual Studio), `⌘ F10` (Visual Studio (macOS)), `Ctrl+R` (Eclipse), `⌘ R` (Eclipse (macOS))     |     Click this button to resume program execution and pause until the execution point reaches the line at the current caret location in the editor. No breakpoint is required. Actually, there is a temporary breakpoint set for the current line at the caret, which is removed once program execution is paused. Thus, if the caret is positioned at the line which has already been executed, the program will be just resumed for further execution because there is no way to roll back to previous breakpoints. This action is especially useful when you have stepped deep into the method sequence and need to step out of several methods at once.       If there are breakpoints set for the lines that should be executed before bringing you to the specified line, the debugger will pause at the first encountered breakpoint.      > **Tip:** > Use this action when you need a kind of temporary breakpoint at a specific line, where program execution should not be interrupted.    |
|  ![Force Run to Cursor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.forceRunToCursor.svg)  |    Force Run to Cursor     `Ctrl+Alt+F9` (Windows), `⌘ ⌥ F9` (macOS), `⌘ ⌥ F9` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ ⇧ \` (macOS System Shortcuts), `Ctrl+Alt+9` (XWin), `Ctrl+Alt+9` (GNOME), `Ctrl+Alt+9` (KDE), `Ctrl+Alt+F9` (Emacs), `Ctrl+Alt+F9` (Sublime Text), `⌘ ⌥ F9` (Sublime Text (macOS)), `Ctrl+Alt+F9` (NetBeans), `Ctrl+Alt+F9` (Visual Studio), `⌘ ⌥ F9` (Visual Studio (macOS)), `Ctrl+Alt+F9` (Eclipse), `⌘ ⌥ F9` (Eclipse (macOS))    |  Continues the execution until the position of the caret is reached. All breakpoints on the way are ignored.  |
|  ![Show Execution Point](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.showCurrentFrame.svg)  |    Show Execution Point   `Alt+F10` (Windows), `⌥ F10` (macOS), `⌥ F10` (IntelliJ IDEA Classic (macOS)), `⌥ F10` (macOS System Shortcuts), `Alt+F10` (XWin), `Alt+Shift+0` (GNOME), `Alt+Shift+0` (KDE), `Alt+F10` (Emacs), `Alt+F10` (Sublime Text), `⌥ F10` (Sublime Text (macOS)), `Alt+F10` (NetBeans), `Alt+NumPad *` (Visual Studio), `⌥ NumPad *` (Visual Studio (macOS)), `Alt+F10` (Eclipse), `⌥ F10` (Eclipse (macOS))  | Click this button to highlight the current execution point in the editor and show the corresponding stack frame in the Frames pane.  |
|  ![Evaluate expression](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.evaluateExpression.svg)  |    Evaluate Expression   `Alt+F8` (Windows), `⌥ F8` (macOS), `⌥ F8` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ L` (macOS System Shortcuts), `Alt+F8` (XWin), `Alt+Shift+8` (GNOME), `Alt+Shift+8` (KDE), `Alt+F8` (Emacs), `Alt+F8` (Sublime Text), `⌥ F8` (Sublime Text (macOS)), `Ctrl+F9` (NetBeans), `Shift+F9` (Visual Studio), `⇧ F9` (Visual Studio (macOS)), `Ctrl+U` (Eclipse), `⌘ U` (Eclipse (macOS))  |  Click this button to [evaluate expressions](examining-suspended-program.html#evaluating-expressions).  |

## See also

### External Links

[Jupyter Notebook](http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/Index.ipynb)

