Python and PyOpenGL Installation

For the assignments we'll be using Python 2.7 along with PyOpenGL 3x. It'd also be good to have NumPy and SciPy installed. Note that the SOCS lab machines in Trottier already have these installed. So if you have trouble running the starter code or your implementation, you might first try it on the SOCS machine (instructions for remote testing is at the end). Once you've installed all the necessary components be sure to check your installation using this sample code.

There are two options for setting up your machine for the assignments. If you already have python 2.7 installed and just want to do a minimal installation then look at the Minimal Installation section. However, it's recommended (to save time and headache) that you install a distribution of python along with PyOpenGL by following the Python Distribution section.

1. Minimal installation:

If there's an existing python 2.7 (you might try this with python 3 but that combination hasn't been tested) installation but no PyOpenGL (and NumPy, SciPy) then the easiest option is to install using pip from the terminal. Instructions for manual installation can be found at: http://pyopengl.sourceforge.net/documentation/installation.html

pip install numpy scipy pyopengl

Linux/Mac: Install GLUT in case it's not already installed (Mac OS may already have it installed). This will depend on your system. E.g. for Ubuntu

sudo apt-get install freeglut3-dev

Windows: For installing PyOpenGL (including GLUT) on Windows see note in the following section.

If pip doesn't exist on your system then it can be installed by following https://pip.pypa.io/en/latest/installing.html (or OS specific installer e.g. for ubuntu: sudo apt-get install python-pip)

2. Installing Python Distribution:

There are three major python distributions: PythonXY (windows only), Anaconda (win/linux/mac), and Enthought Canopy (win/linux/mac). We found anaconda to work smoothly on most platforms and so this is the recommended distribution for doing the assignments. (PythonXY also works well but it's only available for windows and may require uninstalling existing python installation.)

Installing Anaconda + PyOpenGL

Anaconda python 2.7 can be downloaded from: http://continuum.io/downloads#27. It'll install all the required packages except for PyOpenGL. Use the following instructions to install it.

Linux/Mac: Once Anaconda is installed on your Mac/Linux, you can open a terminal and install PyOpenGL as follows:

pip install pyopengl

Windows: If you're running Windows then you need to download PyOpenGL installer from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl

Note for Windows installation:

[Update:The installers at the above link seems to have changed since the time this instruction was posted. Install the wheel (.whl) file as follows from the command prompt:

pip install path-to-the-whl-file-that-you-downloaded
Some additional notes: If your Anaconda is a local installation and you cannot use pip just from the command prompt then use the Anaconda prompt (search "Anaconda Command Prompt" from the start menu). Then "cd Scripts" and use pip as above. ]

If you installed 64-bit version of Anaconda then you should download PyOpenGL-3.1.0.win-amd64-py2.7.exe PyOpenGL-3.1.0-cp27-none-win_amd64.whl otherwise for 32-bit Anaconda download PyOpenGL-3.1.0.win32-py2.7.exe PyOpenGL-3.1.0-cp27-none-win32.whl

Note 2: You can also try the "pip install pyopengl" route for windows. But in that case the pyopengl installer wouldn't install the GLUT library properly. You can manually install GLUT by following this link and copy glut32.dll to "python-installation-directory/Lib/site-packages/OpenGL/DLLS"


Troubleshooting

glutInit error when trying to run the sample: This means that the right version of glut isn't installed on your system. If the installation instructions for glut above didn't work for you then post about it on the Discussion Board.

Spyder crashes on Mac: Downloading spyder from https://bitbucket.org/spyder-ide/spyderlib/downloads is known to have fixed this problem. (see Discussion Board)


IDE

Anaconda comes with an IDE called spyder and works out of the box. You can open a terminal and type "spyder" to start the IDE or add a link to your desktop.

Remotely Testing on SOCS Machines

Linux/Mac:

ssh to one of the lab machines (e.g. lab1-1.cs.mcgill.ca or ubuntu.cs.mcgill.ca) with the option -X for X forwarding.

ssh -X ubuntu.cs.mcgill.ca

Windows:

If you do not have any version of ssh installed you can use Putty and Xming. You can find instructions on how to set them up at X11 Forwarding using Xming and PuTTY.