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:
- Coding assistance:
- Error and syntax highlighting.
- Code completion.
- Ability to create line comments Ctrl0/.
- Ability to run cells and preview execution results.
- Dedicated
Jupyter Notebook
Debugger. - Shortcuts for basic operations with Jupyter notebooks.
- Ability to recognize .ipynb files and mark them with the ipynb file icon icon.
To start working with Jupyter notebooks in PyCharm:
- Set Up Your Environment:
- Create a new Python project.
- Specify a virtual environment.
- Install the Jupyter package.
- Open or Create a Notebook:
- Open an existing
.ipynb
file or create a new one. - Edit and Add Cells:
- Add and edit source cells in the notebook as needed.
- Execute Code Cells:
Execute any of the code cells to start the Jupyter server
and run your code.
Mind the following user interface features when working with Jupyter notebooks in PyCharm.
Jupyter Notebook Interface Overview:
- Jupyter Notebook Toolbar: This toolbar provides quick access to frequently used actions. While additional notebook-specific actions are available in the
Cell menu
, this toolbar offers convenient shortcuts for common tasks. - Code Cell: A code cell within the notebook is where you write and execute executable code. These cells are where you input your Python code for
analysis, calculations, or data manipulation.
- Cell Output: After executing a code cell, the results are displayed in the
cell output area
. This output can take various forms, including text, tables, or plots, depending on the code's purpose and the libraries used. - Cell Toolbar: The cell toolbar, typically hidden by default, contains essential commands for managing code cells. To enable this toolbar, navigate to Project Settings
(Ctrl+Alt+S)
, go to Languages & Frameworks | Jupyter, and check the "Show cell toolbar" option. Once enabled, it provides shortcuts and options for working with code cells efficiently.
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 (Ctrl+Alt+S)
, go to Languages & Frameworks | Jupyter, and select the Show cell toolbar checkbox.
The Jupyter notebook toolbar provides quick access to all basic operations with notebooks:
The Server Log
tab within the Jupyter tool window becomes accessible once you launch a Jupyter server. Within this tab, you can monitor the real-time status
of the Jupyter server and conveniently access the link to open your notebook in a web browser.
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.
You can use the Settings icon to manage the variables loading policyhttps://www.jetbrains.com/help/pycharm/variables-loading-policy.html.