Using Buildout system on Windows
Friday, April 22nd, 2011 11:30 am GMT +2

Okay, so you’ve heard something about buildout system, and started to use it. Once upon a time, your project is required to be deployed on Windows host. Let the show begin…

Buildout is extremely powerful, yet very simple to use tool to do automatic deployments. Imagine, that you need to deploy your app on some random unknown generic Linux host, where there is nothing but gcc and a few system tools (python included) — what a pain in the ass this could possibly be? Having to deal with manual installation of different packages (versions nightmare included) is such a pain. I don’t even want to consider what to do if you don’t have a root access rights on target machine.

Buildout is built by the Zope/Plone team to tackle all above mentioned problems. The only problem, though, is that it works smoothly only on *nix environments, which is not our case.

So, if there is absolutely no way around for you but deployment on Windows, read more.

Step 1. Prepare your windows environment

Scenario described below was tested on virtualboxed WindowsXP machine.

Step 2. Set system %PATH% variable

It should include

  • C:\Python27\
  • C:\Python27\Scripts\
  • C:\MinGW\bin\

Once, this is done gcc, python, easy_install commands should be available in your command line:


C:\nimble\nimble-tests>gcc --v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++
--disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp
--disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs
--disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)


C:\nimble\nimble-tests>easy_install --version
distribute 0.6.11


Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.


C:\nimble\nimble-tests>chmod --help
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
  or:  chmod [OPTION]... OCTAL_MODE FILE...

  -c, --changes           like verbose but report only when a change is made
  -f, --silent, --quiet   suppress most error messages
  -v, --verbose           output a diagnostic for every file processed
  -R, --recursive         change files and directories recursively
      --help              display this help and exit
      --version           output version information and exit

Each MODE is one or more of the letters ugoa, one of the symbols +-= and
one or more of the letters rwxXstugo.

Report bugs to

Configure Distutils

Tell distutils to use MinGW

Create a file called ‘distutils.cfg’ in “C:\Python27\Lib\distutils”. Open it with a text editor (‘notepad distutils.cfg’) and fill in the following lines:

compiler = mingw32

This will allow to use buildout recipes which involve building C extensions.

Upgrade distutils to latest version

Make sure you have latest distutils version, otherwise your buildout will stuck in an infinite loop like this:

Getting distribution for 'distribute'.
Getting distribution for 'distribute'.
Getting distribution for 'distribute'.
Getting distribution for 'distribute'.
Getting distribution for 'distribute'.
Getting distribution for 'distribute'.
Getting distribution for 'distribute'.
Getting distribution for 'distribute'.

Fix this by upgrading distutils in your system-wide Python:

easy_install -U Distribute

Check out upgraded distutils version:

C:\nimble\nimble-tests>easy_install --version
distribute 0.6.15

Finally, run buildout

Run bootstrap:


It will create bin directory & buildout.exe script, which we’re going to run. Here is an example output:

Develop: 'C:\\nimble\\nimble-tests\\src/se'
Uninstalling bin-templates.
Unused options for buildout: 'common-parts'.
Updating common-eggs.
Updating python.
Updating clean-bin-templates.
Installing bin-templates. 

Other useful links