Jupyter Notebooks (formerly IPython Notebooks) are a way of writing Python code in your browser, interactively being able to try some code, tweak it, try it again, examine results, and pick your way through programming. You can also add documentation that is more thorough - and attractive - than plain comments!

Installing Jupyter

Are you in a virtual environment? Install Jupyer for Python 3 using pip.

pip install jupyter

Are you not in a virtual environment? Install Jupyter for Python 3 using pip3.

pip3 install jupyter

Using Jupyter

Running a Jupyter notebook is simple.

jupyer notebook

Then select New > Python 3 in the top right-hand corner. Does it only say Python 2? Make sure you’re in the right virtual environment, and try running the code in the installation section.

  1. Type code in a box (a.k.a. a cell).
  2. Shift + Enter to run the code in the box.

If you want to get cool, change the type of the cell from Code to Markdown and you can get all sorts of formatting for text.

A note of caution

Jupyter Notebooks are a godsend for working with data, but you need to be careful about running code out of order. If you’re submitting something for homework you’ll usually want to run Kernel > Restart & clear output and then Cell > Run All. If your code scrapes 10,000 web pages, though, you probably don’t want to do that.