What happens if you try to build a windows installer "python setup.py bdist_wininst"

Also, have you attempted to specify the compiler in "$PYTHON_ROOT\Lib\distutils\distutils.cfg" ?

I've got a script I use to manually change the "build" section of this file between




to switch between default compilers when I've had issues with setup.py.

On Wed, Mar 24, 2010 at 2:31 PM, Francesc Alted <faltet@pytables.org> wrote:
A Wednesday 24 March 2010 15:38:58 David Cournapeau escrigué:
> Oh, it is not that easy :)
> First, for some reason, the mingw-w64 project does not provide 64
> hosted compilers, and since pushing for mingw cross compilation
> support in distutils would redefine the meaning of insanity, I build
> my gcc. Since building gcc on windows is not a fun ride either, you
> have to build it on unix (I have the scripts on my github account:
> github.com/cournape/).

Mmh, not sure about what you mean by hosted compiler, but there is certainly a
native compiler package for Win64:


It comes with gcc, g++ and gfortran 4.4.4.  gdb support is also there.  So it
seems like a pretty complete toolset for windows amd64.

With it, and with some fixes in numpy sources (very few), I achieved to pass
the build phase.  I can provide the patch in case someone is interested.  The
generated extensions are:

24/03/2010  19:34         1.492.313 multiarray.pyd
24/03/2010  19:34           124.866 multiarray_tests.pyd
24/03/2010  19:34           453.377 scalarmath.pyd
24/03/2010  19:34         1.079.827 umath.pyd
24/03/2010  19:34           121.651 umath_tests.pyd
24/03/2010  19:34           304.014 _sort.pyd

which looks good to my eyes.

Now, when I try to generate the installable package I'm in trouble again:

$ python setup.py bdist
 File "C:
, line 56, in _check_compiler
 File "C:\Python26_64\lib\distutils\msvc9compiler.py", line 359, in
   vc_env = query_vcvarsall(VERSION, plat_spec)
 File "C:\Python26_64\lib\distutils\msvc9compiler.py", line 275, in
   raise ValueError(str(list(result.keys())))
ValueError: [u'path']

So, it looks like either numpy or python cannot determine that the used
compiler is mingw instead of msvc9.  However, when I try to specify mingw
explicitly, I get the next error:

$ python setup.py bdist --compiler=mingw32
Running from numpy source directory.
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
  or: setup.py --help [cmd1 cmd2 ...]
  or: setup.py --help-commands
  or: setup.py cmd --help

error: option --compiler not recognized

Someone could tell me why distutils can be told to use mingw32 compiler for
the build stage but not for bdist?  What is more, why the need for a compiler
for bdist if numpy is already built? I feel that I'm almost there, but some
piece still resists...

Francesc Alted
NumPy-Discussion mailing list

Patrick Marsh
Ph.D. Student / NSSL Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory