Make sure that the Python package distutils is installed before
continuing. For example, in Debian GNU/Linux, installing python-dev
also installs distutils.

Python must also be compiled with the zlib module enabled. This is
practically always the case with pre-packaged Pythons.

Compilers

To build any extension modules for Python, you’ll need a C compiler.
Various NumPy modules use FORTRAN 77 libraries, so you’ll also need a
FORTRAN 77 compiler installed.

Note that NumPy is developed mainly using GNU compilers. Compilers from
other vendors such as Intel, Absoft, Sun, NAG, Compaq, Vast, Porland,
Lahey, HP, IBM, Microsoft are only supported in the form of community
feedback, and may not work out of the box. GCC 4.x (and later) compilers
are recommended.

Linear Algebra libraries

NumPy does not require any external linear algebra libraries to be
installed. However, if these are available, NumPy’s setup script can detect
them and use them for building. A number of different LAPACK library setups
can be used, including optimized LAPACK libraries such as ATLAS, MKL or the
Accelerate/vecLib framework on OS X.

Cython

To build development versions of NumPy, you’ll need a recent version of
Cython. Released NumPy sources on PyPi include the C files generated from
Cython code, so for released versions having Cython installed isn’t needed.

The two most popular open source fortran compilers are g77 and gfortran.
Unfortunately, they are not ABI compatible, which means that concretely you
should avoid mixing libraries built with one with another. In particular, if
your blas/lapack/atlas is built with g77, you must use g77 when building
numpy and scipy; on the contrary, if your atlas is built with gfortran, you
must build numpy/scipy with gfortran. This applies for most other cases
where different FORTRAN compilers might have been used.

One relatively simple and reliable way to check for the compiler used to build
a library is to use ldd on the library. If libg2c.so is a dependency, this
means that g77 has been used. If libgfortran.so is a a dependency, gfortran
has been used. If both are dependencies, this means both have been used, which
is almost always a very bad idea.