02 January 2020

This tutorial describes how to setup virtualenv on ecelinux. If your are installing it in another environment, skip up to Creating virtualenv step.

ECE Linux Machines

There are 8 linux machines available: ecelinux[1-8].uwaterloo.ca. The instructions have been tested on the newer machines ecelinux[1-3].uwaterloo.ca. Please use those machines only.

Switching shell to bash

Check your current shell

$ echo $SHELL
/bin/csh

If the current shell is /bin/csh, switch it to bash using the web interface here. See the bottom of the page under the heading Unix Shell Change.

# replace USER with your watiam id
$ ssh USER@ecelinux.uwaterloo.ca
$ echo $SHELL
/bin/bash

Install pip

Detailed instructions are available at https://pip.pypa.io/en/stable/installing

$ wget https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py --user
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Collecting wheel
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.29.0
$ export PATH=~/.local/bin:$PATH

Install virtualenv via pip

$ pip install virtualenv --user
Collecting virtualenv
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-15.1.0

Create virtualenv space for the course

Detailed instructions are available at http://docs.python-guide.org/en/latest/dev/virtualenvs

$ mkdir stqam
$ cd stqam
$ virtualenv venv

Activate virtualenv (this needs to be done at every login to use the environment)

$ source ./venv/bin/activate
(venv) [user@ecelinux stqam]$

Install required packages

Install grako, coverage, ipython, and z3-solver. Installation of ipython and z3-solver might take a while.

$ source ./venv/bin/activate
$ pip install grako
$ pip install coverage
# Optional, but convenient way to interact with python
$ pip install ipython
# Not needed for Assignment 1
$ pip install z3-solver

To de-active the environment

(venv) [user@ecelinux stqam]$ deactivate

To activate and deactivate virtualenv during each login session

$ source ./venv/bin/activate
(venv) $ coverage --help
(venv) $ deactivate
$

After virtualenv is activated you should be able to use python, coverage, ipython, and other python commands as usual.