Setting Up Python

Python is a popular language for scientific computing and data science, as well as being a great for general-purpose programming. Installing all of the scientific packages individually can be a bit difficult, so we recommend an using an all-in-one installer, like Anaconda.

Regardless of how you choose to install it, please make sure you install Python version 3.x (e.g., 3.4 is fine).

We will teach Python using the Jupyter notebook, a programming environment that runs in a web browser. For this to work you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported (some older browsers, including Internet Explorer version 9 and below, are not).

Windows

Mac OS X

Linux

We recommend the all-in-one scientific Python installer Anaconda.

  1. Download the installer that matches your operating system and save it in your home folder. Download the default Python 3 installer.
  2. Open a terminal window.
  3. Type
    bash Anaconda-
    and then press tab. The name of the file you just downloaded should appear.
  4. 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).

Installing ggplot Python package

ggplot is a Python implementation of the R ggplot2 graphics package. It is not intended to be a feature-for-feature port of ggplot2 but provides some of ggplot2 functionality in Python ecosystem.

The easiest approach to install ggplot is via conda package manager provided in Anaconda distribution that you have installed above.

Windows

Mac OS X

Linux

  1. Open default terminal application (on Ubuntu that will be gnome-terminal).
  2. Type into terminal conda install -c conda-forge ggplot and accept when prompted for feedback.

Checking that your installation worked

Now it is time to make sure that your Anaconda installation was successful. Download check_env.py file which is a Python script that will check if Anaconda has been correctly installed on your system. From your terminal, navigate to the directory that contains check_env.py and execute the following:

python check_env.py
If you receieve an AssertionError, it will inform you how to correct your installation. Otherwise, it will tell you that your system is good to go and ready for Data Carpentry!