Skip to content

Whats with Windows builds

Mike Toews edited this page Jun 16, 2018 · 2 revisions

What's up with numpy and Windows?

Note: this page has only historical relevance, you can now pip-install for windows

If you're on Linux, you are probably used to your package manager. You want the basic scipy packages, so you do something like:

sudo apt-get install python-numpy python-scipy python-matplotlib

If you're on a Mac, that you just brought home from the Apple store, you can install Python from Python.org, and then do this:

pip install numpy scipy matplotlib

pip will download binary wheel packages, and install them; the whole process will take around 30 seconds.

If you're on Windows, and you try the same thing with pip, all hell will break loose.

Specifically, pip will download the source packages for numpy, scipy, matplotlib, and then try and compile them.

Particularly for scipy, you are unlikely to have a compiler installed that can do this - see: https://mingwpy.github.io/motivation.html

Unlike Mac, Windows has no default library for optimized linear algebra routines (BLAS, LAPACK). If you have no BLAS / LAPACK library, scipy compilation will fail. Numpy compilation will work by falling back to default and very slow implementations, but the resulting numpy installation would likely be painful to use for any significant numerical work.

The obvious thing for us numpy-ers to do, is to compile up Windows binary wheels that do include a fast BLAS / LAPACK library. Unfortunately, this is not at all easy for the following reasons. See : mingwpy background and mingwpy issues for more detail.

  • The choice of BLAS / LAPACK library is not clear : see https://mingwpy.github.io/blas_lapack.html. In particular there are still some problems with OpenBLAS that need resolving;
  • The standard Python.org Windows installers use MS Visual C++. We can't use MSVC++ on its own to compile scipy because we need a Fortran compiler. Compiling OpenBLAS with Visual Studio gives poor performance, and compiling ATLAS with Visual Studio is not supported. Thus we need another compiler. This is likely to be mingw or mingw-w64. The current (December 2015) release build process for Windows uses an old copy of mingw. mingw cannot build 64-bit applications, nor can it build libraries compatible with libraries built with MSVC 14 / 2015 (Python 3.5 is built with MSVC 14);
  • Mingw-w64 is the obvious choice for a compiler, but it has some numerical problems due to differences in gcc default / MSVC default floating point precision (see math precision issues). These give some floating point errors on numpy / scipy testing. Mingw-w64, like mingw, cannot yet link to the MSVC 14 / 2015 runtimes needed for Python 3.5 extensions.