Manage Jupyter notebook servers
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 Jupyter server that you connect to by specifying its URL and token.
Launch a local Jupyter server
To run a Jupyter server, execute any code cell. When you initiate cell execution, PyCharm launches a 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 the server's configuration details.
Once the server is launched, it is shown as a managed server in the list of the servers in the Jupyter notebook toolbar.
Connect to a Jupyter server
Go to
.In the New Jupyter Connection dialog, select the connection type:
Start a local Jupyter server: run a Jupyter server in a local directory that will be attached to your workspace.
Connect to a Jupyter server using a URL: establish a connection to a remote Jupyter server. The target URL should contain a server name or its address and the access token.
Once the connection has been established, the server and its structure are shown in the Project tool window.
Stop the Jupyter server
To stop any running server, switch to the Jupyter Server tool window and click Stop Jupyter server. Preview the status in the Server Log window.
Once you have shut down the server, the current session is terminated. When you start the server next time, execution results for all previous sessions and all notebooks will be lost.
Restart the kernel
You might want to refresh your calculations without shutting down the entire server and affecting any other notebooks. To restart the currently running kernel, click on the Jupyter notebook toolbar. You can then view the kernel status in the Server Log window:
You can execute your notebook code cells on a specific Jupyter server.
When you launch any managed server, by default it uses the current Python interpreter and the automatically selected port. However, you can select any other available interpreter and specify an alternative port. You can also connect to any configured server if you know its URL and token.
Configure a Jupyter server
Select Configure Jupyter Server from the list of the Jupyter servers in the Jupyter notebook toolbar.
Select Use Managed Server. By default, the server uses the current Python interpreter. If necessary, you can select any other available interpreter from the list.
Set the server settings using the Command line arguments field.
Set Environment variables and assign values to them.
Click OK to apply the changes and close the dialog, or click Apply to keep the dialog open.
Execute any code cell to run the managed server.
Connect to a configured Jupyter server
Select Configure Jupyter Server from the list of the Jupyter servers on the Jupyter notebook toolbar.
Select Configured Server and specify the server's path. It should contain the server's name or its address, and the access token.
Click OK to apply the changes and close the dialog, or click Apply to keep the dialog open.
Once the connection has been established, the server and its structure are shown in the Workspace tool window.