Debugging Jupyter Notebooks

Hi all!

I use Jupyter Notebooks in a similar way as Jeremy described for Deep Learning and Geoinformtatics projects … I love the interactivty and fast prototyping which I could never get in my usual IDE Pycharm …
The only thing that I am really missing is a good debugger in my Jupyter Notebooks ( I am a bit spoiled by the Pycharm debugger ) as things tend to get messy the more complex the tasks are …

How is your workflow for developing Jupyter Notebooks? I have read that VS Code could be a good alternative? I am looking forward to your suggestions! :slight_smile:

Edit: I just tried pixiedust. I work a lot with pandas dataframes and then visualization of those is not excately great in pixiedust, so this doesn´t help me either. I feel this is a cool project, but needs to develop quite a bit further until it is really useful.

Cheers,
Harry

1 Like

I mostly work in Jupyter and if I have to make some .py files, I copy the contents from notebooks to py scripts. For debugging I rely only on printing stuff here and there. The main idea is when I print things the printed things should be the same as I code I wrote. If not print some more things or see the source code and try to find the bug and it has worked pretty well till now.

For py scripts I use VS Code but I never try to write new code in Code as notebook allow me to check things quickly.

Hi Harry,

You can use PyCharm with Jupyter by the “Attach to process…” command. Choose the xxx.json process corresponding to the notebook. (You have first to create a project linked to the fastai environment and your notebook directory.) However, you can’t debug notebook cells directly but only what the cell calls. This limitation has not been an obstacle for me in practice.

I agree that PDB is awful, yet seems to be popular. Maybe because it’s a “hackish” rite-of-passage? But for me it only recalls the crappy text based debuggers I had no choice but to use in the 1980s.

I tried pixiedust too and found it frustratingly incomplete and unstable.

Please let me know what you find if you try VS Code. AFAIK, like PyCharm it also does not debug notebook cells directly.

Cheers,
Malcolm