7

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

7

4 Answers 4

5

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Do yo know if the improvements are still there?
Great, thanks, this actually seems to work! Also see stackoverflow.com/q/9000164, stackoverflow.com/q/37184618
Hmm... this downloads OpenBLAS libraries, but numpy still links to just the normal 'blas', 'cblas', 'lapack', 'blas', 'cblas', 'lapack', 'blas', 'cblas', 'lapack' libraries instead of OpenBLAS. I did use Anaconda but it shouldn't really make a difference. No MKL libs though. I wouldn't care except Pythran requires OpenBLAS apparently.
3

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.

3 Comments

Thanks for posting the script. I've tried following your script to install numpy+scipy without mkl on Windows but it still tries to install mkl when it gets to this line: conda install -y blas numpy nose openblas. I tried manually specifying conda install numpy=1.16.2=py37_blas_openblash442142e_0 but it can't seem to find openblas when I do np.show_config(). How did you get it to install?
agree with @stevew. This doesn't work and wants to install mkl even if you have the nomkl meta package installed.
@stevew, @beginner_, I think conda now installs mkl by default, at the time I wrote the script it installed with openblas. Have you tried adding the flag blas=*=openblas to the end of that command line?
0

The build instructions for SciPy is tested a number of times and it seems to be working.

You can find the instructions here http://scipy.github.io/devdocs/building/windows.html

Note that this is still a very delicate procedure and needs to be done very carefully. It still does not guarantee success thanks to Windows being Windows. However please take the time to report any issues should you encounter any at https://github.com/scipy/scipy.org/issues (notice it is not the scipy repo but but scipy.org repo)

Comments

0

I am not sure what's the error you have recieved when trying to get openblas & numpy using anaconda.

For openblas on windows using anaconda3 python 3.6v this works:

conda install -c menpo openblas

ref: https://anaconda.org/menpo/openblas

For numpy: it is :conda install numpy. if you are looking for a specific version of numpy use: conda install numpy=version_number

1 Comment

This works but only for numpy. Doesn't work if you also need scipy or scikit-learn. The conda will want to install mkl again because as far as I know scipy builds on anaconda are only available for mkl. The only "solution" is to only use pip, assuming one find all the needed dependencies there for windows (unlikely)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.