Python 3.7.x introduced a new method to insert a breakpoint in the code.
Before Python 3.7.x to insert a debugging point we had to write import pdb; pdb.set_trace() which honestly I could never remember (and I also created a snippet on VS Code to auto complete it).

Now you can just write breakpoint() that's it!

Now... the only problem is that by default that command will use pdb which is not exactly the best debugger you can have. I usually use ipdb but there wasn't an intuitive way of using it... and no, just installing it in your virtual environment, it won't be used by default.

How to use it then? It's very simple. The new debugging command will read an environment variable named PYTHONBREAKPOINT. If you set it properly, you will be able to use ipdb instead of pdb.

export PYTHONBREAKPOINT=ipdb.set_trace

At this point, any time you use breakpoint() in your code, ipdb will be used instead of pdb.

References

Other articles

If we try to use the usual ipdb commands from a Jupyter (IPython
notebook)

importipdb;ipdb.set_trace()

we will get a similar error:

--------------------------------------------------------------------------MultipleInstanceErrorTraceback(mostrecentcalllast)<ipython-input-1-f2b356251c56>in<module>()1a=4---->2importipdb;ipdb.set_trace()3b=54printa5printb/home/nnn/anaconda/lib/python2.7/site-packages/ipdb/__init__.pyin<module>()14# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.15--->16fromipdb.__main__importset_trace,post_mortem,pm,run,runcall,runeval,launch_ipdb_on_exception1718pm# please pyflakes/home/nnn/anaconda/lib/python2.7/site-packages/ipdb/__main__.pyin<module>()71# the instance method will create a new one without loading the config.72# i.e: if we are in an embed instance we do not want to load the config.--->73ipapp=TerminalIPythonApp.instance()74shell=get_ipython()75def_colors=shell.colors/home/nnn/anaconda/lib/python2.7/site-packages/traitlets/config/configurable.pycininstance(cls,*args,**kwargs)413raiseMultipleInstanceError(414'Multiple incompatible subclass instances of '-->415'%s are being created.'%cls.__name__416)417MultipleInstanceError:MultipleincompatiblesubclassinstancesofTerminalIPythonApparebeingcreated.