ECE398BD: Installing Python

In this course, we will be making use of Python 2 and several freely available packages for big data. Assignments will be distributed as Jupyter Notebooks (formerly known as IPython Notebooks).

Python on EWS Machines

The EWS machines ship with Enthought Canopy. To load Python and start the IPython/Jupyter Notebook environment, open up a terminal and run

module load canopy
ipython notebook

After a few seconds, your web browser should open to the IPython/Jupyter Notebook environment. If it does not, look for output in the terminal for a statement like “The IPython Notebook is running at: (address)” and visit address in your browser (typically http://localhost:8888).

You can also use this at home via FastX. Note that there are occasionally file locking issues with IPython on network shares (or possibly other reasons), so it may be preferable to install Canopy/Anaconda on your home computer rather than use the EWS machines.

module load canopy/1.6.1

will load the current version of Canopy.

Python at Home

We recommend you either install Enthought Canopy with the free academic license or Continuum Anaconda with Python 2 (do not install the Python 3 version or miniconda – they are not suitable for this course). These Python distributions contain most of what you will need for the course. You may need you to manually install some packages using the built-in package manager (detailed below). For Microsoft Windows users, we generally recommend Canopy over Anaconda.

If you are a *nix or Mac OS X user, note that your system likely ships with a Python install. We still recommend you install and use Canopy or Anaconda, as the system install of Python will not come with many of the packages we will need for this course and may change depending on operating system updates.

Once installed, you can open a terminal and run (*nix/Mac OS X users)

ipython notebook

Windows users can find a launcher for IPython/Jupyter notebooks in their Start menu (or equivalent).

Converting IPython notebooks to an Older Version

Assuming you have a current version of Canopy/Anaconda, you may want to use your notebook with an older version (e.g. Canopy 1.4.1 on the EWS machines).

jupyter nbconvert --to notebook --nbformat 2 mynotebook.ipynb

will make a copy of your notebook (called mynotebook.v2.ipynb) compatible with the old version on the EWS machines. Note that this conversion is not guaranteed to work/it is at your own risk.

Installing Packages

Depending on your installation, you may need to install some packages. Canopy uses the command

enpkg (package name)

Anaconda uses the command

conda install (package name)

Most Python distributions also have the pip package installer. You can install packages by

pip install (package name)

globally (i.e. for the whole system) or

pip install (package name) --user

for the current user. Note that you may need a development toolchain (e.g. XCode on Mac OS X or the “Development Tools” option on many Linux distributions or appropriate version of Microsoft Visual Studio and/or MinGW on Microsoft Windows) to use pip.

All three methods (enpkg, conda, pip) will resolve dependencies. If you are using Canopy, start by using enpkg and failing that, use pip. If you are using Anaconda, start by using conda and failing that, use pip.

A table of some packages you may need is given below (and the corresponding package names). We only list packages which are not included by default with Canopy/Anaconda.

Package Canopy Anaconda pip
Scikit-learn scikit_learn scikit-learn scikit-learn
NetworkX networkx networkx networkx
cvxopt cvxopt cvxopt (Linux/Mac OS X only) cvxopt


Microsoft Windows users will have to use pip to install cvxopt on Anaconda, which will require development tools. A rough guide is provided here. We do not recommend this for novice users, and therefore suggest using Canopy on Windows instead (or connecting to the EWS machines via FastX).

Warnings in your code

Depending on what version of Python you are using (and what version of the corresponding packages), you may see some warnings. Some of these are due to unsafe practices or deprecated behavior. Unlike languages like C, Python's warnings are generally quite readable. Your code should give minimal warnings (e.g. maybe one or two about variables being clobbered, or an option or class being renamed in a future release).

In general, you should try to resolve warnings in your code. They are there for a reason.

If you insist on using deprecated behavior, note that you can disable or turn off certain warnings with code like:

import warnings

warnings.filterwarnings('ignore’)

To repeat, it is highly not recommended to do this. The only acceptable case for this course to use this (or similar) is when your code runs without warning on the EWS machines, but your submitted notebook was run with a newer version of Python (+ packages) and thus induces warnings.

Python Resources

Lab 1 provides you a basic tutorial to some of Python's features.

The following resources may be useful:

And a few links to write code concisely: