PyCharm 2019.1 Help

Configuring Jupyter Notebook

In PyCharm, you can execute code cells using:

  • Managed server – a Jupyter server that is automatically launched by PyCharm for the current project. It will be terminated when you close PyCharm.

  • Configured server – any local or remote Jupyter server that you connect to by specifying its URL and token.

Launch a Jupyter server

To run a Jupyter server just execute any code cell. When you initiate cell execution, PyCharm launches the Jupyter server on the local host using any available port (by default, it is the 8888 port). You can switch to the Jupyter Server tool window to preview server's configuration details.

Jupyter server is running. Jupyter tool window

Once the server is launched, it is shown as a managed server in the Jupyter Server widget in the Jupyter toolbar. You can also see the automatically created server kernel in the list of kernels. This kernel is based on the PyCharm project interpreter.

Jupyter notebook toolbar; Managed server is connected

Stop the Jupyter server

To stop any running server, switch to the Jupyter Server tool window and click the the Stop button icon or select the corresponding command in the Jupyter Quick List. Preview the status in the tool window.

Stopping the server

Once you have shut down the server, the current session is terminated. When you start the server next time using the Run server icon icon or the Jupyter Quick List, execution results for all previous sessions and all notebooks will be lost.

You can execute your notebook code cells on a specific Jupyter servers.

Connect to a configured Jupyter server

  1. Click the Jupyter Server widget and select Configure Jupyter Server.

    Configure a Jupyter server

  2. In the Jupyter Server dialog, select Configured Server and specify server's path including an URL and a token.

    Configure a Jupyter server. Settings dialog

    Click Apply and OK.

  3. Because the managed server is still retained, you need to explicitly switch to the configured server. Click the Jupyter Server widget and select Switch to current Jupyter Server.

    Switch to the current Jupyter Server
  4. By this time, the server is configured but it is not running yet.

    Configured server is not connected

    Execute any code cell to run the server.

  5. If you see the following warning, the kernel of the newly configured server doesn't match your current project interpreter. For example, it might have a different set of the installed packages.

    Warning requesting to register interpreter as a kernel

    You can register your project interpreter as a kernel on the configured server by clicking the corresponding link. After that you can see it in the list of the kernels for the configured server.

    Two kernels are registered for the configured server

At any time you can start using the managed server again. Click the Jupyter Server widget and select Configure Jupyter Server, and in the Jupyter Server dialog, select Managed Server.

Last modified: 23 April 2019