Tutorial for installing numpy with OpenBLAS on Windows

Please, I do need a light here. I want to install numpy using a good BLAS/LAPACK lib on Windows, but absolutely no page explains the process well enough. It seems OpenBLAS is a good and fast option.

The goal is to use "theano" with "keras", and "theano" requires that the libraries be "dynamic", not static. (Not sure I understand what that means, but it causes slowness and memory issues)

Please treat me as a complete newbie. Give me a step by step tutorial on how to do it! Don't forget to tell me "where" files should go! Which folders should go in PATH! What commands exactly I should call, and what are their output, where? What do I do with their results or with compiled files? How does numpy find them? Etc. All the sites I've seen seem to think I'm a linux expert and already know everything.

What I have tried:

  • Downloaded the compiled version of numpy+mkl from here -- This does install numpy, it becomes usable, but theano presents the memory leak problem, besides working slowly. Is it a matter of setting the right ldflags in the .theanorc file? If so, which are the flags? - About the MKL libraries, this answer may be useful?

  • Tried installing Anaconda - it doesn't work either, and I had no idea about what went wrong. It gave me messages suggesting installing some extra stuff, it worked but incredibly slow. More than 10 times slower than my bugged numpy version mentioned above (so, unacceptable, impossible to work at that speed). If I have to go changing everything about Anaconda, it's better to use a regular python instead and know what is going on.

  • Found these already compiled BLAS/LAPACK libraries (.dll and .lib) files. But.... what am I supposed to do with them? -- Simply adding their folders to the PATH var and installing numpy gives me "numpy-atlas", not the libraries I downloaded. How do I make numpy see them?

  • Tried to understand this page, but yet, it seems it will lead me exactly to the previous case, what will I do with the results? Where are the libs they suggest I use? What are the suggested quickbuild scripts, where are they?

  • Found the Cygwin option here. I haven't tried it, but it sounds it should be something easier than reinstalling all my python and packages, all from Cygwin


Solution 1:

Year 2021: this works with miniconda on Windows 10

conda create -n openblas python=3.8
conda activate openblas
conda install conda-forge::blas=*=openblas
conda install -c conda-forge numpy

Tested also with matplotlib-base.

Solution 2:

Tried following the building instructions in http://scipy.github.io/devdocs/building/windows.html a number of times without success.

[MY SOLUTION]

After extensive reading of the logs and related forums, came up with a method that has worked for me in two windows machines already. Posted a batch file with the steps I used in https://github.com/jhvital/build-scipy-openblas.

The show_config method shows linkage to openblas libraries, and this was confirmed by comparing the runtimes of scripts against the scipy installed with conda install scipy, which installs the mkl package.

Still I'm not entirely sure whether the libraries were linked correctly. Feedback would be appreciated.