How to fix “no lapack/blas resources found” on Windows

On Windows, you don't have a central package manager as you would in Linux or macOS. Therefore, there's no easy way to write a single command to install, build and configure libraries and their supplements. In addition to that, the lack of open source compilers needed to build the libraries makes installing tools such as NumPy and SciPy extra hard.

SciPy official documentation demonstrate a way to install it along with OpenBLAS from source, but there is simply too many steps for newcomers.

Normally, you would have to build SciPy and NumPy manually, then statically link them to the Fortran libraries such as BLAS and LAPACK. The process requires a compiler, a bunch of commands and basic understanding of how make and Makefile works.

Fix "no lapack/blas resources found" on Windows

The "no lapack/blas resources found" error simply means that SciPy/NumPy cannot find BLAS or LAPACK where they expect them to be in.

no lapack/blas resources found fix

Error messages can pop up in many forms:

numpy.distutils.system_info.BlasNotFoundError: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.

Or

$ pip3 install scipy

Collecting scipy

  Using cached https://files.pythonhosted.org/packages/07/76/7e844757b9f3bf5ab9f951ccd3e4a8eed91ab8720b0aac8c2adcc2fdae9f/scipy-1.1.0.tar.gz

Building wheels for collected packages: scipy

  Running setup.py bdist_wheel for scipy ... error

  [[very_long_stack_trace]]

      File "scipy/linalg/setup.py", line 19, in configuration

        raise NotFoundError('no lapack/blas resources found')

   numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

The simplest solution to solve "no lapack/blas resources found" is installing SciPy/NumPy from pre-built .whl files (or pre-built wheels).

Another option is installing them from Anaconda or its lightweight sibling Miniconda, which is an awesome ecosystem that makes it much easier for data scientist to get jobs done.

This article will only focus on how to fix "no lapack/blas resources found" on Windows by installing SciPy/NumPy from pre-built wheels.

  • First, you need to make sure that you had Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 for Python 3, or Microsoft Visual C++ 2008 Redistributable Package x64, x86, and SP1 for Python 2.7 installed in your system, as many binaries depend on them.
  • Once you've installed Microsoft Visual C++, access Unofficial Windows Binaries for Python Extension Packages from a web browser of your choice. The page contains pre-built wheels for the most popular python packages.
  • You need to find .whl files of numpy+mkl. You can directly go to this link to avoid searching through the long webpage. Choose the suitable file based on your system architecture (win32/amd64), Python implementation (CPython or PyPy), Python version (cp36 means CPython 3.6).NumPy prebuilt binariesIf you need SciPy, scroll to SciPy section and download the corresponding .whl before we proceed to the installation.
  • Once you've grabbed all the wheels package, open up your Command Prompt as administrator inside the downloads folder. Type each of these commands into the prompt.
    pip install scipy‑xxx.whl
    pip install numpy‑xxx.whl

Update : New versions of pip allow you to install the wheels package directly from the URL. So you can simply open up a Command Prompt as Administrator, then type pip install https://download.lfd.uci.edu/pythonlibs/z4tqcw5k/numpy-1.19.5+mkl-cp39-cp39-win_amd64.whl without actually downloading anything before-hand.

Click to rate this post!
[Total: 4 Average: 5]

Leave a Comment