Not logged in. Login

Installing Python Libraries

There are a few dependencies for doing the programming in this course. Roughly: Python 3.5 or later and a few libraries for it. Since several of the libraries are C extensions, they aren't super easy to install by hand. Here are some docs for three options to get things running

In Debian/Ubuntu

You should be able to install some basics in the operating system, and then the Python packages you need with Pip:

sudo apt-get install python3 python3-dev python3-pip
sudo apt-get build-dep python3-scipy python3-matplotlib
pip3 install --user scipy matplotlib pandas statsmodels scikit-learn jupyter

Additional packages you need should be easy to install with pip3 install.

With Anaconda

The Anaconda distribution is designed to have everything you need for data analysis. You can go to the Anaconda download page and get the latest version (likely 64-bit) installer. Install according to their instructions. Once it's installed, you can use the Anaconda iPython or Jupyter Notebook for an interactive prompt (REPL), and Spyder as an IDE.

Most of the packages you need will be installed as part of Anaconda. If there are others, you can open an Anaconda Prompt and install with pip like this:

pip install pykalman

In CSIL: Linux

The libraries you need should be installed in the CSIL workstations on the Linux side of things. You should be able to use python3 to run programs and ipython3 to get a REPL.

Anaconda is also installed: you can start the Spyder IDE with the command spyder.

Additional libraries can be installed with a command like this:

pip install --user pykalman

For remote access, you can SSH to csil-cpu1.csil.sfu.ca to csil-cpu4.csil.sfu.ca. You can see some additional remote CSIL access instructions as well.

In CSIL: Windows

You will find Anaconda installed on the CSIL workstations in Windows. You can generally work as described above.

I had to change the default browser for Jupyter away from IE. If you do as well, create or edit the file \Users\USERNAME\.jupyter\jupyter_notebook_config.py (or create a template with the command jupyter notebook --generate-config) and add:

import webbrowser
webbrowser.register('firefox', None, webbrowser.GenericBrowser(r'c:\Program Files\Mozilla Firefox\firefox.exe'))
c.NotebookApp.browser = 'firefox'

Remotely: gateway.sfucloud.ca

Students in this class should be able to SSH to gateway.sfucloud.ca with their standard SFU username and password.

The libraries you need for the course should be installed there, but if you need any extras:

pip3 install --user pykalman

If you want to use matplotlib to create plots (in files), you have to disable an attempt to connect to the graphical environment before importing like this: (*)

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

In a VM

You can also do all of this working in a VirtualMachine. This isn't the easiest way to work, but as a way to have a consistent environment, it can't be beat.

Updated Sun May 16 2021, 16:14 by ggbaker.