A Jupyter notebook is a browser-based interface where you can write, run, remix and republish code.
It is free software you can install and run like any other open-source library. It is used by scientists, scholars, investors and corporations to create and share their research.
It is also used by journalists to develop stories and show their work. Examples published by past teachers of this class include:
“As Opioid Crisis Ramped Up, Pills Flowed Into Vermont by the Millions” by Andrea Suozzo
“A frenzy of well drilling is depleting aquifers in California farmland.” by Gabrielle LaMarr LeMee
“What it’s like to go to school when dozens have been killed nearby” by Iris Lee
“City of Chicago Parking and Camera Ticket Data” by David Eads
You can find hundreds of other examples on GitHub, including work by Buzzfeed, ProPublica, The Economist, POLITICO, The Markup and the Los Angeles Times.
There are numerous ways to install and configure Jupyter notebooks. Since this tutorial is designed for beginners, it will demonstrate how to use JupyterLab Desktop, a self-contained application that provides a ready-to-use Python environment with several popular libraries bundled in. It can be installed on any operating system with a simple point-and-click interface.
Advanced users like to take advantage of Python’s power tools to have more control over when and where code is installed on their system. Readers interested in the techniques preferred by the pros should consult our appendix. It requires use of your computer’s command-line interface.
1.1. Install JupyterLab Desktop¶
The first step is to visit JupyterLab Desktop’s homepage on GitHub in your web browser.
Scroll down to the documentation below the code until you reach the Download section.
Then pick the link appropriate for your operating system. The installation file is large so the download might take a while.
Find the file in your downloads directory and double click it to begin the installation process. Follow the instructions presented by the pop-up windows, sticking to the default options.
Your computer’s operating system might flag the JupyterLab Desktop installer as an unverified or insecure application. Don’t worry. The tool has been vetted by Project Jupyter’s core developers and it’s safe to use.
If your system is blocking you from installing the tool, you’ll likely need to work around its barriers. For instance, on MacOS, this might require visiting your system’s security settings to allow the installation.
1.2. Open a Python 3 notebook¶
Once the program is installed, you can accept the installation wizard’s offer to immediately open the program, or you can search for “Jupyter Lab” in your operating system’s application finder.
That will open up a new window that looks something like this:
Hit the “Python 3” button in the launcher panel on the right and you’re ready to move on to our next chapter.