Python Setup Instructions


Jump to: InstallationEveryday Use

Overview

Throughout this course, we will perform programming exercises in Python. We have prepared a standardized Python environment so that all students can run the required code examples and use the required open-source libraries, regardless of the student's preferred operating system (Windows, Mac, or Linux).

We will use Python 3.6, with these open-source libraries:

  • NumPy 1.15
    • Arrays and array arithmetic, matrix and vector arithmetic
  • SciPy 1.1
    • Sparse matrix routines, optimization, scientific computing, etc.
  • Scikit Learn 0.20
    • Machine learning tools
  • Matplotlib 3.0
    • Plotting tools

This basic environment is typical of those used throughout contemporary industrial and academic machine learning teams.

To install and maintain this environment, we recommend the free Anaconda python package manager (supported on all major platforms).

Early in the course, TAs will some offer support at office hours for installing or maintaining Python on your laptop. However, it is your responsibility to acquire and maintain the packages and environments you need well before any deadlines. No extensions will be given due to installation issues.

We have verified that these instructions successfully install the required environment on a standard issue Tufts EECS unix account home directory.

Installation

One-Time Install Step 1/2: Install "conda" package manager

Expected time for this step: 15 minutes

Required disk space: 0.5 GB

Install Miniconda (a bare-essentials version of Anaconda) to your $HOME directory or wherever on your hard disk you prefer to install it.

The installation can be done by following the instructions here:

Tip for Unix users: When it asks whether to put Miniconda on your PATH within your .bashrc or other config file, please say yes.

One-Time Install Step 2/2: Install Python packages for the "comp135_env" environment

Expected time for this step: 10 minutes

Required disk space: 1.5GB (sorry, modern compiled linear algebra routines are hefty)

After you have conda installed, you can install the standard packages listed above (NumPy, SciPy, etc.) in one action via a convenient .yml specification file: comp135_env.yml

After downloading this file, you can setup the environment and install all required packages in just one terminal command:

1
$ conda env create -f comp135_env.yml

Everyday Use

These steps should be done everytime you sit down to work on this class.

Step 1/2: Activate the environment

This step makes sure that when you call "python" from your terminal, it refers to our comp135_env version of python and its associated packages (not other python installs you might have on your system).

Windows terminal:

1
$ activate comp135_env

Unix terminal:

1
$ source activate comp135_env

Step 2/2: Do your work

Open an interactive Python (IPython) terminal session from a Windows/Unix terminal that has been activated:

1
$ ipython

Launch a Jupyter Notebook from a Windows/Unix terminal that has been activated:

1
$ jupyter notebook