Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ipython: Debugging Code Inside Notebook

I installed epd 7.3.2 free on amazon EWS EC2 and coinfigured ipython notebook as a public notebook server.

I run the the server in this way:

nohup ipython notebook --profile=nbserver %

Everything is working fine, I can login with password on https and code.

Now I'd like to use pdb/ipdb to debug python functions inside the notebook, but on internet I can't find the procedure how to setup the debugger.

Can someone help me ?

Regards

Massimo

These are the installed packages:

root@domU-xx-xx-xx-xx-xx-xx:/opt/epdFree7.3.2/bin# ./pip freeze
EPD==7.3
Examples==7.3
Jinja2==2.6
MKL==10.3
PIL==1.1.7
Pygments==1.4
PythonDoc==2.7.3
appinst==2.1.2
apptools==4.1.0
casuarius==1.0
chaco==4.2.0
cloud==2.4.6
configobj==4.7.2
distribute==0.6.26
enable==4.2.0
enaml==0.2.0
enstaller==4.5.6
etsproxy==0.1.1
freetype==2.4.4
idle==2.7.3
ipdb==0.7
ipython==0.13.1
kernmagic==0.1.0
matplotlib==1.1.0
nose==1.1.2
numpy==1.6.1
ply==3.4
pyaudio==0.2.4
pyface==4.2.0
pyglet==1.1.4
python-dateutil==1.5
pytz==2011n
pyzmq==2.1.11
scipy==0.10.1
tornado==2.2
traits==4.2.0
traitsui==4.2.0
wsgiref==0.1.2
wxPython==2.8.10.1

root@domU-xx-xx-xx-xx-xx-xx:/opt/epdFree7.3.2/bin# ./enpkg -l
prefix: /opt/epdFree7.3.2
Name                 Version              Store
============================================================
appinst              2.1.2-1              -
apptools             4.1.0-1              -
casuarius            1.0-1                -
chaco                4.2.0-1              -
cloud                2.4.6-1              -
configobj            4.7.2-2              -
distribute           0.6.26-1             -
enable               4.2.0-1              -
enaml                0.2.0-1              -
enstaller            4.5.6-1              api rh5-64
EPD                  7.3-0                -
etsproxy             0.1.1-1              -
Examples             7.3-0                -
freetype             2.4.4-1              -
idle                 2.7.3-1              -
ipython              0.13.1-2             api rh5-64
Jinja2               2.6-2                -
kernmagic            0.1.0-1              -
matplotlib           1.1.0-1              -
MKL                  10.3-1               api rh5-64
nose                 1.1.2-1              -
numpy                1.6.1-3              api rh5-64
PIL                  1.1.7-3              -
ply                  3.4-1                -
pyaudio              0.2.4-1              -
pyface               4.2.0-1              -
pyglet               1.1.4-2              -
Pygments             1.4-1                -
python_dateutil      1.5-2                -
PythonDoc            2.7.3-1              -
pytz                 2011n-1              -
pyzmq                2.1.11-1             -
scipy                0.10.1-0             -
tornado              2.2-1                -
traits               4.2.0-1              -
traitsui             4.2.0-1              -
like image 481
msalese Avatar asked Feb 28 '13 10:02

msalese


People also ask

Can I debug in Jupyter lab?

JupyterLab 3.0 includes a visual debugger that allows to interactively set breakpoints, step into functions, and inspect variables with any Jupyter kernel that implements the Jupyter debugger protocol.

How do you run the whole code in Jupyter Notebook?

To run a piece of code, click on the cell to select it, then press SHIFT+ENTER or press the play button in the toolbar above. Additionally, the Cell dropdown menu has several options to run cells, including running one cell at a time or to run all cells at once.


1 Answers

Just expanding @Ken Arnold's point so people don't have to read all the answers to figure this out. As of version 1.0, debugging DOES WORK in the ipython notebook.

Just start the cell with %debug and then you'll be able to use the typical controls for ipdb ((n)ext, step, etc.).

like image 135
cd98 Avatar answered Oct 20 '22 00:10

cd98