Introduction to Programming in Python: Setup

Python

Python is a popular language for general-purpose programming that has been widely adopted for scientific computing. Unfortunately, installing all of its scientific packages individually can be difficult, so we will be relying on an all-in-one installer called Anaconda.

For all instructions below, please ensure you install Python version 3

Windows

  1. Open https://conda.io/miniconda.html with your web browser.
  2. Download the Python 3 installer for Windows.
  3. Install Python 3 using all of the defaults for installation. Make sure the Register Anaconda as my default Python checkbox is selected before clicking 'Install'.

Mac OS X

  1. Open https://www.continuum.io/downloads with your web browser.
  2. Download the Python 3 installer for OS X.
  3. Install Python 3 using all of the defaults for installation.

Linux

  1. Open https://conda.io/miniconda.html with your web browser.
  2. Download the Python 3 installer for Linux.
  3. Install Python 3 using all of the defaults for installation. (Installation requires using the shell. If you aren't comfortable doing the installation yourself stop here and request help at the workshop.)
  4. Open a terminal window.
  5. Type
    bash Miniconda3-
    and then press tab. The name of the file you just downloaded should appear.
  6. Press enter. You will follow the text-only prompts. When there is a colon at the bottom of the screen press the down arrow to move down through the text. Type yes and press enter to approve the license. Press enter to approve the default location for the files. Type yes and press enter to prepend Anaconda to your PATH (this makes the Anaconda distribution the default Python).

The Bash Shell, Jupyter, and Git

Windows

  1. Open a command prompt
    • Open Start Menu
    • type cmd
    • press [Enter]
  2. Type the following lines into the command prompt window one at a time exactly as shown, hitting [Enter] after each one.
    conda create -n bash m2-base git jupyter pandas tornado=4.4 console_shortcut
    
    activate bash
    
    conda install -c swc nano
    Continue to press [Enter] at any prompts and wait for the 'C:\' to return after each command before progressing (the first step can take many minutes and look like it's stuck, so please be patient).
  3. You should now be able to find a new folder in your Start menu called 'Anaconda'. Inside the folder will be two 'Anaconda Prompt' programs. Choose the one that doesn't say '(bash)'
  4. Activate the correct conda environment by typing:
    activate bash

Optionally, Cmder is a (much) nicer terminal environment for Windows.

Mac OS X

The default shell in all versions of Mac OS X is Bash.

  1. Open the 'Terminal' program (found in /Applications/Utilities).
  2. Type the following into the Terminal command prompt window exactly as shown:
    conda install git jupyter pandas

Optionally, iTerm2 is a more feature-rich terminal environment that is a little easier on the eyes.

Linux

The default shell is usually Bash, but if your machine is set up differently you can run it by opening a terminal and typing bash.

  1. Open the Terminal
  2. Type the following into the command prompt window exactly as shown:
    conda install git jupyter pandas

Data for the workshop

You will also need the gapminder dataset. Open a terminal window, copy the following commands, and press enter:

cd ~/Desktop
git clone https://github.com/biologyguy/swc-data.git