OscarVanL
OscarVanL

Reputation: 719

How do I add launch arguments to PyCharm's built-in Jupyter interpreter?

I'm using PyCharm Professional's built-in Jupyter Notebook functionality to open .ipynb files in my project.

When I try to print a large dictionary I get the error:

IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.

Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)

Existing answers to this error suggest adding a launch argument when starting the Jupyter Notebook interpreter: https://stackoverflow.com/a/44679222/6008271

However, as this is a built-in server within PyCharm, I'm not sure where to add this. Please can you advise where in PyCharm I add launch arguments for Jupyter?

Upvotes: 2

Views: 1126

Answers (2)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83616

PyCharm 2022.2.2 does not offer any options still.

For this particular question, it may be easier to edit Jupyter files directly in your Python virtual environment, than starting to use non-managed server. This is due to PyCharm's inability (at least documented) to pass settings to Jupyter Server.

The particular settings are in jupyter-server/services/kernels/handlers.py

Change:

if self.iopub_msg_rate_limit > 0 and msg_rate > self.iopub_msg_rate_limit

To

if self.iopub_msg_rate_limit > 0 and msg_rate > 100_000

Upvotes: 0

WildWilyWilly
WildWilyWilly

Reputation: 141

I don't think you can add flags like suggested in that answer, because in your case the execution command will be run by PyCharm itself, but the documentation says you can choose a different server than the default one (if the kernel is compatible).

This means you can configure the Jupyter NoteBook server (see here how to configure it) and then select it by clicking in the upper bar on the name of the current server (should be something like Managed Jupyter server: auto-start) and select the "configure server" option that will then be visible. In the menu that will appear, select "managed server" and from the python interpreter list you'll be able to choose among whatever servers you have on your local system.

So long story short, instead of using the flags to run your notebook with an increased data rate limit, you:

Upvotes: 2

Related Questions