Connect iPython REPL to an existing notebook

Posted on Wed 06 May 2015 in Notes

This is a really smart trick if you are developing using iPython Notebooks. What you do is open a REPL that is connected to the notebook you are working on (think of it as an ipython instance that shares the functions and variables with your notebook).

This is great as a scratch pad, easy checking of variables and for doing long print statements that would otherwise bog down a browser.

Simply run the following command from the terminal after opening the notebook server:

$ ipython console --existing

In recent versions of Anaconda, I get a very long error-message that ends with:

ImportError: No module named 'jupyter_console'

To fix this, simply install jupyter_console using pip from the terminal, like so:

$ pip install jupyter_console

I have no idea why this isn't installed by default with Anaconda.