In search of visual debugger/editor for notebooks (Linux)

Well, I just spent half a day of this precious human life getting our lesson notebooks to run in PyCharm. Only to find out…wait for it…that PyCharm has never implemented debugging for notebooks. This has been an active request since March 2016.

So may I ask some knowlegeable person to respond to my plea? I have already spent too many years doing terminal-based editing and debugging, and strongly prefer never to go back to it. When Think Pascal was first published, it was a liberation of time and creativity.

My needs are basic: navigate and explore source code efficiently; trace, use breakpoints, and examine variables during execution.

Is there such a visual debugger in the Python/Jupyter world, one that you know works from actual experience? This is all local to Ubuntu 16.04 with Nvidia GPU. My sincere thanks in advance and afterwards!

P.S. One work around could be to transcribe the lesson notebooks into plain .py files. But I’d much rather use a debugger that works right with notebooks.

1 Like

Answering my own question…

You CAN get PyCharm working for fastai. You need to “download” the course notebooks as .py files, then PyCharm lets you trace and navigate the various calls in a visual IDE. Once the going gets complex, I personally find it far easier to explore the fastai code and debug my own in the IDE than in a notebook.

If anyone wants to duplicate my setup for a fastai project, please ask here, and I will write up the steps.

BTW, my setup is all local. PyCharm docs say that it can be used with a remote Python interpreter, but I have not tried to do this.

1 Like

Whilst not a visual debugger (and as you may already know) the python debugger works fine in notebooks and supports all the debugging things you asked for.

1 Like

pdb.set_trace() is your friend

Thanks for the responses. You are both referring to PDB. I used PDB during the first week of the course and still do occasionally inside notebooks, but no longer for complex debugging. The essential problem with text based debuggers (for me) is that the full context is impossible to see when items are constantly scrolling out of view. With a visual debugger, I can see stack, variables, and several sources, all at once. The entire context can be explored without losing immediate access to any parts of it. For myself, that results in deeper understanding and fewer errors. Besides, you get efficient source navigation, watches, and fancy breakpoints.

PDB unfortunately reminds me of the “bad old days” of debugging C, Pascal, and assembly during the 80s. Our main tools then were GDB, MPW, and scattered print statements. Once visual IDEs were invented, I never wanted to go back.

In the end, I suppose it’s a matter of personal preference and what works best for your own style. Happy coding!

2 Likes

If you want to forego using Jupyter notebooks, I’d recommend VSCode … you and can run/step-thru code using the IDE. It’s a pretty roboust IDE.

Thanks, I will check it out. Right now, PDB + notebook export + PyCharm are working well enough.