Debugging functions in scripts when called by PyCharm's Jupyter Notebook editor

Answered

As per the title, when running interactively in the built in Jupyter Notebook editor in PyCharm, is it possible to set breakpoints in external modules contained in separate .py files?.

You can attach the debugger to the interactive python console and set breakpoints in modules that are imported, but it doesn't seem to work the same when using the PyCharm Jupyter Notebook editor.

I'm wondering what I am missing.

Thanks.

5 comments
Comment actions Permalink

Hi

>when running interactively in the built in Jupyter Notebook editor

Do you execute cells or run the cell content in the console? Not sure if I got it correctly. In general, PyCharm can't debug Jupyter Notebooks at the moment.

0
Comment actions Permalink

I'm not trying to debug the notebook itself.

I have the notebook running within PyCharm calling functions in separate .py files.

I want to set a breakpoint within the .py file. Then call the function from the Notebook and then have execution stop in the .py file, not the notebook.

I'm not running the cell content from the console. I'm running it from the actual open notebook.

0
Comment actions Permalink

I see, thank you for the clarification. The only way to do it now is to use Debug Server, please see the relevant docs: https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config

0
Comment actions Permalink

Using  Jupyter Notebook within pyCharm is slow and experiemental.

I would like individual cell debugging feature while in scientific mode.

Ipython backend provide all the necessary API for this.

Spyder already implemented this feature I want.
https://github.com/spyder-ide/spyder/issues/9361

0

Please sign in to leave a comment.