[Numpy-discussion] Problems building numpy

numpy-discussion at robince.ftml.net numpy-discussion at robince.ftml.net
Fri Jul 13 06:36:19 EDT 2007


I am keen to evaluate numpy as an alternative to MATLAB for my PhD work
and possible wider use within the department. To make a fairer
comparison I wanted to build it with optimised ATLAS/LAPACK etc. hence
building from source.

I am running into some problems though.

I am using Windows XP SP2, with latest Cygwin and I'm trying to follow
the instructions on the wiki.

Firstly, is what I'm trying possible? On the Installing Scipy/Windows
page it says MinGW gcc and g77 are best supported, but also says to
build against binary Python download you need to use MSVC. From
http://boodebr.org/main/python/build-windows-extensions it seems
building extensions with gcc is fine (and I built PyCrypto successfully
as a test). So can I do what I am trying to do (build numpy/scipy on
windows using cygwin without MSVC installed) against the downloaded
Python distribution? If not, I can't find any resources about building
Python from source on Windows using Cygwin, so it seems like I would be
completely stuck.

The next problem is that although I filled in the site.cfg file as
documented (below), the setup.py script doesn't seem to pick it up and
doesn't look in any of the specified directories. I can get around this
by putting ATLAS/LAPACK libs in C:\, but obviously this isn't very
satisfactory. Also is the entry for fftw correct? I couldn't find any
information about this on the wiki.

libraries = f77blas, cblas, atlas
library_dirs = C:\cygwin\home\mqbxfri2\ATLAS\atlas_win32\lib
include_dirs = C:\cygwin\home\mqbxfri2\ATLAS\atlas_win32\include
libraries = lapack, f77blas, cblas, atlas
library_dirs = C:\cygwin\home\mqbxfri2\ATLAS\atlas_win32\lib
include_dirs = C:\cygwin\home\mqbxfri2\ATLAS\atlas_win32\include
libraries = fftw3-3
library_dirs = "C:\fftw"

Following this there seem to be some more problems with the setup.

"python setup.py build --compiler=mingw32" fails with:
  line 731, in _find_existing_fcompiler
  AttributeError: 'NoneType' object has no attribute 'customize'

c is the result of the new_fcompiler function.

"python setup.py config_fc --help-fcompiler" failes with:
  File "c:\Python25\lib\distutils\msvccompiler.py", line 270, in
    "version of the compiler, but it isn't installed." % self.__product) 
  distutils.errors.DistutilsPlatformError: Python was built with Visual
  Studio version 7.1, and extensions need to be built with the same
  version of the compiler, but it isn't installed.

Although as I mentioned I can successfully build extensions with gcc.

Reading through the help I saw that there is a "none" fcompiler type, so
using that I get a bit further:

"python setup.py build --compiler=mingw32 --fcompiler=none" run
initially with build directory removed gives the same NoneType error,
but then running it again the build appears to start. I then run into
bug #220 http://projects.scipy.org/scipy/numpy/ticket/220:

numpy\core\src\multiarraymodule.c: In function `initmultiarray':
numpy\core\src\multiarraymodule.c:7563: error: `NPY_ALLOW_THREADS'
undeclared (first use in this function)
numpy\core\src\multiarraymodule.c:7563: error: (Each undeclared
identifier is reported only once
numpy\core\src\multiarraymodule.c:7563: error: for each function it
appears in.)

I would really appreciate any help to get this working. I understand
building numpy doesn't require a fortran compiler, but scipy does. I am
hoping to build scipy as well, so presumably the config system needs to
recognise the cygwin g77 compiler for that to work? During the config I
also see the following message:
don't know how to compile Fortran code on platform 'nt' with 'gnu'
compiler. Supported compilers are: absoft
Does this mean it isn't possible to build scipy on Windows with Cygwin

If I am eventually successful I would be happy to update the wiki with
some more detailed instructions based on my experiences. 

Finally, I can't find any discussion of the relevant merits of ATLAS vs
MKL, other than the different licensing. Is it expected that MKL
performs better? Which is recommended?

Thanks very much,


More information about the NumPy-Discussion mailing list