Skip to content

Commit 8a67d77

Browse files
committed
code review iteration
* Give the OS-specific site-packages directories for NumPy's OpenBLAS. * Include the `pip install numpy --only-binary numpy` variation, but not `:numpy:` since pip install doesn't document that. `pip install --only-binary numpy numpy` also works but that's confusing to parse. * Drop the sentence on the Accelerate bug on macOS < 11.3 since this isn't the place for it. * Also drop the search-order part about Accelerate? This applies to Numpy 1.19 as well as 1.21+. * Clarify the part about finding external BLAS/LAPACK libs. Some doc should explain what people need to know about installation. If they need portable, reproducible results, they should probably use the same BLAS/LAPACK libs compiled with the same compiler everywhere. It's unfortunate to install NumPy + SciPy linked to Accelerate, along with more pips, only to discover that NumPy won't load on their Mac and have to start over. Or will SciPy reject the older LAPACK API and have problems using different BLAS/LAPACK libs? Installing pips in Docker takes over an hour (vs. 15 minutes) if linking NumPy and SciPy to an external BLAS/LAPACK (and another pip conditionally compiles from source if NumPy did). Worse to have to debug CI failures because their CI on Linux computes different output than Accelerate. Should this also explain how to tell which release of OpenBLAS is included in a NumPy installation? (What got us into installing NumPy from source was needing an OpenBLAS bug fix release.)
1 parent 4452927 commit 8a67d77

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

numpy/distutils/misc_util.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,26 +2364,27 @@ def show():
23642364
23652365
NumPy BLAS/LAPACK Installation Notes
23662366
------------------------------------
2367-
Installing a numpy wheel (e.g. ``pip install numpy``) includes
2367+
Installing a numpy wheel (``pip install numpy`` or force it
2368+
via ``pip install numpy --only-binary numpy``) includes
23682369
an OpenBLAS implementation of the BLAS and LAPACK linear algebra
2369-
APIs. In this case, ``library_dirs`` reports the build time
2370-
configuration; the OpenBLAS library is actually in
2371-
``site-packages/numpy.libs/`` or
2372-
``site-packages/numpy/.dylibs/`` and it's compiled with
2373-
gcc/gfortran.
2374-
2375-
Installing numpy from source (e.g.
2376-
``pip install numpy --no-binary numpy``) looks for BLAS and
2377-
LAPACK dynamic link libraries at build time. This search is
2378-
influenced by the environment variables
2379-
NPY_BLAS_ORDER/NPY_LAPACK_ORDER, if set, and the file
2380-
``~/.numpy-site.cfg``, if present.
2370+
APIs. In this case, ``library_dirs`` reports the original build
2371+
time configuration as compiled with gcc/gfortran; at run time
2372+
the OpenBLAS library is in
2373+
``site-packages/numpy.libs/`` (linux), or
2374+
``site-packages/numpy/.dylibs/`` (macOS), or
2375+
``site-packages/numpy/.libs/`` (windows).
2376+
2377+
Installing numpy from source
2378+
(``pip install numpy --no-binary numpy``) searches for BLAS and
2379+
LAPACK dynamic link libraries at build time as influenced by
2380+
environment variables NPY_BLAS_LIBS, NPY_CBLAS_LIBS, and
2381+
NPY_LAPACK_LIBS; or NPY_BLAS_ORDER and NPY_LAPACK_ORDER;
2382+
or the optional file ``~/.numpy-site.cfg``.
2383+
NumPy remembers those locations and expects to load the same
2384+
libraries at run-time.
23812385
On macOS, 'accelerate' (Apple's Accelerate BLAS library) is in
2382-
the default search order (but not in numpy 1.20) after
2383-
'openblas'.
2384-
Loading a numpy library that's linked to Accelerate on
2385-
macOS < 11.3 will detect an Accelerate bug and raise a
2386-
RuntimeError.
2386+
the default build-time search order -- except in numpy 1.20 --
2387+
after 'openblas'.
23872388
23882389
Examples
23892390
--------

0 commit comments

Comments
 (0)