Detailed instructions for compiling matplotlib on Windows XP

Hello all,

I finally, after much pain and anguish, succeeded at compiling MPL with GTKAgg on windows and I thought people might be interested to know how I managed it. Of course, your mileage may vary…

  1. Install Python (I used the Python (x,y) distribution of 2.6:
  2. Install the GTK bits and pieces. For some reason using the newest ones causes some problems with paths. I can confirm that this set works on at least two computers:

Glade3.6.7withGTK+.exe (Install this to c:\GTK so that MPL build can find it without playing with paths)


  1. Install libpng and freetype using the installers (also includes the zlib dll). They will default to install to c:\Program Files\GnuWin32 . This is fine, but note the location.
  2. Either checkout the MPL source from subversion, or download a tarball and unpack it
  3. Download the win32_static files, and unpack them to the place where your MPL source is, you should then have a folder in the MPL source folder called win32_static
  4. Open the file in the MPL source folder
  5. Edit line 51 (or so) to read:: ‘win32’ : [‘win32_static’,‘c:\Program Files\GnuWin32’]
  6. Install Visual Studio 2008 Express if you do not have a version of Visual Studio 2008 on your computer
  7. Open a console and type:: python build --compiler=msvc bdist_wininst
  8. Wait for it to finish, then:: python install to install MPL
  9. If everything worked right, you should be able to open a python shell and type

import matplotlib
import pylab

  1. And you should see a GTK rendered plot window with a small square in the center hopefully
    Improvements to this procedure would be greatly appreciated - but this finally seems to work…



Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ibell@…901…

cell: (607)227-7626