This course uses Jupyter notebooks.
Colab!
You are welcome to install Python/Jupyter on your own computer, but it isn’t necessary to do so. Some users prefer to use a cloud based Jupyter environment to learn Python. A very popular environment is Google Colab:
https://colab.research.google.com/
You will need a Google account to use this service, but it has some nice features that make it convenient to use:
- You don’t have to install and configure the software;
- Notebooks are stored in the cloud (in your Google Drive) rather than on your computer;
- Google provides the same document sharing features for notebooks as it does for other documents in your Google Drive.
Installing Python Using Anaconda
Python is a popular language for scientific computing, and great for general-purpose programming as well. Installing all of its scientific packages individually can be a bit difficult, however, so we recommend the all-in-one installer Anaconda.
Regardless of how you choose to install it, please make sure you install Python version 3.x (e.g., 3.4 is fine). Also, please set up your python environment at least a day in advance of the workshop. If you encounter problems with the installation procedure, ask your workshop organizers via e-mail for assistance so you are ready to go as soon as the workshop begins.
Windows - Video tutorial
-
Open https://www.anaconda.com/download with your web browser.
-
Download the Python 3 installer for Windows.
-
Double-click the executable and install Python 3 using MOST of the default settings. The only exception is to check the Make Anaconda the default Python option.
Mac OS X - Video tutorial
-
Open https://www.anaconda.com/download with your web browser.
-
Download the Python 3 installer for OS X.
-
Install Python 3 using all of the defaults for installation.
Linux
Note that the following installation steps require you to work from the shell. If you run into any difficulties, please request help before the workshop begins.
-
Open https://www.anaconda.com/download with your web browser.
-
Download the Python 3 installer for Linux.
-
Install Python 3 using all of the defaults for installation.
a. Open a terminal window.
b. Navigate to the folder where you downloaded the installer
c. Type
$ bash Anaconda3-
and press tab. The name of the file you just downloaded should appear.
d. Press enter.
e. Follow the text-only prompts. When the license agreement appears (a colon will be present at the bottom of the screen) hold the down arrow until the bottom of the text. Type
yes
and press enter to approve the license. Press enter again to approve the default location for the files. Typeyes
and press enter to prepend Anaconda to yourPATH
(this makes the Anaconda distribution the default Python).
Getting the Data
The data we will be using is taken from the gapminder dataset. To obtain it, download and unzip the file python-novice-gapminder-data.zip. In order to follow the presented material, you should launch a Jupyter notebook in the root directory (see Starting Python).
Starting Python
We will teach Python using the Jupyter notebook, a programming environment that runs in a web browser. Jupyter requires a reasonably up-to-date browser, preferably a current version of Chrome, Safari, or Firefox (note that Internet Explorer version 9 and below are not supported). If you installed Python using Anaconda, Jupyter should already be on your system. If you did not use Anaconda, use the Python package manager pip (see the Jupyter website for details.)
Mac OS X Users
To start the notebook, you will need to access the command line through Terminal or Git Bash.
There are two ways to open Terminal on Mac:
1) In your Applications folder, open Utilities and double-click on Terminal
2) Press Command + spacebar to launch Spotlight. Type Terminal
and then double-click the search result or hit Enter
After you have launched Terminal, type the command:
$ jupyter notebook
To start the Python interpreter without the notebook, open a terminal or Git Bash and type the command:
$ python
Windows Users
To start the notebook, you will need to access the command line through the Command Prompt.
Use the shortcut keys Windows Logo Key + R to launch the Run window, then type in cmd
and press Enter.
After you have launched the Command Prompt, type the command:
jupyter notebook