Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Scipy Install: No Lapack/Blas Resources Found

People also ask

How do I manually install SciPy?

We can install the SciPy library by using pip command; run the following command in the terminal: pip install scipy.

How do I download SciPy?

Type and run pip install scipy in the command prompt. This will use the Python Package index, and install the core SciPy packages on your computer. You can also install other core packages like Numpy and Matplotlib by using the pip install numpy and pip install matplotlib commands.


The following link should solve all problems with Windows and SciPy; just choose the appropriate download. I was able to pip install the package with no problems. Every other solution I have tried gave me big headaches.

Source: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

Command:

 pip install [Local File Location]\[Your specific file such as scipy-0.16.0-cp27-none-win_amd64.whl]

This assumes you have installed the following already:

  1. Install Visual Studio 2015/2013 with Python Tools
    (Is integrated into the setup options on install of 2015)

  2. Install Visual Studio C++ Compiler for Python
    Source: http://www.microsoft.com/en-us/download/details.aspx?id=44266
    File Name: VCForPython27.msi

  3. Install Python Version of choice
    Source: python.org
    File Name (e.g.): python-2.7.10.amd64.msi


My python's version is 2.7.10, 64-bits Windows 7.

  1. Download scipy-0.18.0-cp27-cp27m-win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
  2. Open cmd
  3. Make sure scipy-0.18.0-cp27-cp27m-win_amd64.whl is in cmd's current directory, then type pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl.

It will be successful installed.


The solution to the absence of BLAS/LAPACK libraries for SciPy installations on Windows 7 64-bit is described here:

http://www.scipy.org/scipylib/building/windows.html

Installing Anaconda is much easier, but you still don't get Intel MKL or GPU support without paying for it (they are in the MKL Optimizations and Accelerate add-ons for Anaconda - I'm not sure if they use PLASMA and MAGMA either). With MKL optimization, numpy has outperformed IDL on large matrix computations by 10-fold. MATLAB uses the Intel MKL library internally and supports GPU computing, so one might as well use that for the price if they're a student ($50 for MATLAB + $10 for the Parallel Computing Toolbox). If you get the free trial of Intel Parallel Studio, it comes with the MKL library, as well as C++ and FORTRAN compilers that will come in handy if you want to install BLAS and LAPACK from MKL or ATLAS on Windows:

http://icl.cs.utk.edu/lapack-for-windows/lapack/

Parallel Studio also comes with the Intel MPI library, useful for cluster computing applications and their latest Xeon processsors. While the process of building BLAS and LAPACK with MKL optimization is not trivial, the benefits of doing so for Python and R are quite large, as described in this Intel webinar:

https://software.intel.com/en-us/articles/powered-by-mkl-accelerating-numpy-and-scipy-performance-with-intel-mkl-python

Anaconda and Enthought have built businesses out of making this functionality and a few other things easier to deploy. However, it is freely available to those willing to do a little work (and a little learning).

For those who use R, you can now get MKL optimized BLAS and LAPACK for free with R Open from Revolution Analytics.

EDIT: Anaconda Python now ships with MKL optimization, as well as support for a number of other Intel library optimizations through the Intel Python distribution. However, GPU support for Anaconda in the Accelerate library (formerly known as NumbaPro) is still over $10k USD! The best alternatives for that are probably PyCUDA and scikit-cuda, as copperhead (essentially a free version of Anaconda Accelerate) unfortunately ceased development five years ago. It can be found here if anybody wants to pick up where they left off.


Sorry to necro, but this is the first google search result. This is the solution that worked for me:

  1. Download numpy+mkl wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy. Use the version that is the same as your python version (check using python -V). Eg. if your python is 3.5.2, download the wheel which shows cp35

  2. Open command prompt and navigate to the folder where you downloaded the wheel. Run the command: pip install [file name of wheel]

  3. Download the SciPy wheel from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy (similar to the step above).

  4. As above, pip install [file name of wheel]


This was the order I got everything working. The second point is the most important one. Scipy needs Numpy+MKL, not just vanilla Numpy.

  1. Install python 3.5
  2. pip install "file path" (download Numpy+MKL wheel from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
  3. pip install scipy

You probably just have too new (unsupported) Python 3.x installed.

This page has overcomplicated solutions to the problem. Most of numpy / scipy users should not need to compile their numpy installations or need to rely on 3rd party "numpy+mkl" wheels.

Downloading a compiler is an anti-pattern, you do not want to build numpy, only use it. [github.com/numpy]

Solution

  • Once you have installed supported python version, remove your non-working numpy installation with
pip uninstall numpy

and install scipy with

pip install scipy --only-binary numpy
  • The --only-binary numpy will force installing binary wheel (.whl) version of numpy. If it fails, you have too new (not yet supported) version of python.

  • If you have multiple python versions installed, you can ensure that pip is installing the python version you want by

<path_to_python_executable> -m pip install <X> 

instead of pip install <X>.

Why this is happening?

  • Scipy relies on numpy, as can be seen from the setup.py or just by reading the pip install logs.
  • If you have too new (non-supported) python installation, there are no built wheel (.whl) in the pip repository, but tarballs (.tar.gz), which in this case require the user machine to compile some C++-code during installation. See also: Python packaging: wheels vs tarball (tar.gz)

Appendix

  • Check the https://pypi.org/project/numpy/ for list of supported Python versions. Currently (2020-11-04) the newest supported python version is Python 3.9. when using numpy 1.19.3 or above, and Python 3.8 for numpy 1.19.2. (For compatibility of older numpy versions, see numpy release notes)
  • If you are on Windows and see pip trying to install numpy-<x>.tag.gz, you know it probably will not work. Try older version of Python, instead. You want to see pip to installing a binary wheel for numpy for Windows (numpy-<x>.whl). You can check the wheels in pip available for numpy here.