csc302h — engineering large software systems — winter 2014

cloning your group's repo

each group has their own git repo, hosted on cdf, that only group members can access. each repo has been pre-populated with a snapshot of the master branch of matplotlib's github repo. the address for your group's repo is:

https://git.cdf.toronto.edu/csc302-XXX
where XXX is the repo number assigned to your group.

when you access your repo with the git command you will be prompted for a username & password. your username is your cdf account name, and your password & repo number have been sent to you by your instructor. if you have forgotten how to access your repo, please ask your teammates before contacting your instructor or ta.

now for the fun stuff! to clone your repo on cdf (or anywhere else) run the command:
> git clone https://git.cdf.toronto.edu/csc302-XXX matplotlib
remember to replace the XXX with your group's repo number. an example of what you should see when cloning your repo is shown in the figure below. note that i entered my cdf username, matt, when prompted, and that my repo number is 004. please use your own username & repo number when cloning your group's repo.
cloning your repo
you now have a local git repo that is an exact clone of your group's master repo. lets have a look at it! change into the new matplotlib directory and list all the files in it:
contents of your repo


building your copy of matplotlib

so far, so good. we have a copy of our group's git repo containing matplotlib. the next step is to build it. on cdf you don't have to worry about all the dependencies because they are all present. building on your own couputer could be more complicated, and is therefore out of the scope of this howto. for help building on your own computer have a look at the matplotlib documentation, in particular, here.

ok, back on cdf now. from your matplotlib directory, run the command:

> python setup.py build
note the word build. we only want to build it, not install it. we can't install it on cdf anyway because we are not admins. after issuing the command to build, you will see lots of output scrolling by & the whole process will take a few minutes. once it's all finished, you will have a new build directory containing your ready-to-run matplotlib.

running a matplotlib test

the final step is to run a matplotlib test. there are plenty of examples that we can use to test that our matplotlib build is working.

before running, we need to make sure we have the right stuff in our PYTHONPATH and that we are running the correct version of matplotlib (ours). Note that cdf has it's own site copy of matplotlib installed. cdf's matplotlib is not the one we want to run!

first, run the following command to see which shell you are using:
> echo $SHELL
if your shell is tcsh, run the following:
> setenv PYTHONPATH ~csc302h/winter/pub:$PWD/build/lib.linux-x86_64-2.7
> python -S examples/mplot3d/surface3d_demo2.py
if your shell is bash, run these:
> export PYTHONPATH=~csc302h/winter/pub:$PWD/build/lib.linux-x86_64-2.7
> python -S examples/mplot3d/surface3d_demo2.py
you should now be looking at a blue sphere!
matplotlib 3d example
there are a few important things to note here: there are many other alternatives on how to build and run matplotlib for csc302h. consider this howto as the bare minimum for building and running matplotlib on cdf. when working on your assignments, you should ensure that your code can be run this way, as this is how your ta & instructor will run your code.

hope that was helpful!