ipythonGetting started with ipython

Download ipython for free


IPython is a Read-Evaluate-Print Loop shell for interactive Python development. It supports interactive visualizations using GUI toolkits, and provides a kernel for Jupyter. It can also be embedded into other projects.

There are other similar REPL shells for Python, for example, ptpython and bpython.


VersionRelease Date

Installation and Usage

Like the built-in python interactive shell, IPython is a REPL (Read-Evaluate-Print Loop) shell, with a variety of features that make it more pleasant to use for day-to-day Python development than the built-in REPL shell.


To install it:

pip install ipython

Or, via Anaconda:

# To install into the active environment:
$ conda install ipython 

# Or, to create a new environment with IPython installed:
$ conda create -n <env_name> ipython

Or, via Enthought Canopy:

$ enpkg ipython


After installation, run it using your default Python (2 or 3) using:


Or to use Python 3:


ipython shell

Getting Help


This gives you an introduction and overview of IPython's features.


This lists all methods and fields of the object and its documentation (if it exists).


Same as above, provides even more detail about the object, in particular will try to find and display the source code for the object.

object.<TAB Key>

TAB-completion that lists and iterates through available fields/methods of an object. Due to the dynamic nature of Python not all methods can be discovered this way. Also private methods (starting with _ ) will be hidden by default, insert a _ and press TAB again to display them.


This displays a quick-reference for the IPython shell.

IPython vs Jupyter

IPython has two parts to it: A command line interface that replaces the default python REPL and a way to run Python through the web browser as a graphical user interface.

With the latest developments the browser part has been split into the Jupyter project that enables multiple programming languages to use the graphical interface. It is still possible to use IPython as a Python kernel for this.

Up to date setup instructions for Jupyter can be found in the official install docs.

ipython , or jupyter console , when invoked from the command line without any other parameters will enter an interactive terminal session as below: Jupyter Console

jupyter qtconsole , or ipython qtconsole before version 5, will start a multi-tabbed QT based console:

QT Console

jupyter notebook , or ipython notebook before version 5, will start a server and by default open up a web page, at http://localhost:8888/tree , with the "Home" view of the current directory. This allows you to open existing notebooks or new kernels in several languages, depending on which you have installed; each will be opened in a new browser tab.

Notebooks allow you to mix markdown, including MathJax, code from the kernel of your choice, plots and graphs, images and even videos. Home Viewenter image description here

Pasting into IPython


%paste demo

This is the primary Magic Method for pasting. It directly pastes text from the system clipboard, intelligently handling common issues with newlines and indentation.


%cpaste demo

If you are using IPython via SSH, use %cpaste instead, as it does not need to access the remote system clipboard.

Since IPython 5.0.0, the improved prompt toolkit should directly handle pasting multi-line code without the need for %paste or %cpaste .

Store variables on IPython

%storemagic stores variables and macros on IPython's database. To automatically restore stored variables at startup add this to ipython_config.py :

c.StoreMagic.autorestore = True


In [1]: l = ['hello',10,'world']
In [2]: %store l
In [3]: exit

(IPython session is closed and started again...)

ville@badger:~$ ipython
In [1]: l
Out[1]: ['hello', 10, 'world']


It should be noted that if you change the value of a variable, you need to %store it again if you want to persist the new value.

Note also that the variables will need to be pickleable; most basic python types can be safely %store’d.

IPython shortcuts, tips and tricks