17 assert (!blas.isILP64) && (!lapack.isILP64);
22 text = (lib.generators.toINI {} {
23 ${blas.implementation} = {
24 include_dirs = "${lib.getDev blas}/include:${lib.getDev lapack}/include";
25 library_dirs = "${blas}/lib:${lapack}/lib";
26 runtime_library_dirs = "${blas}/lib:${lapack}/lib";
27 libraries = "lapack,lapacke,blas,cblas";
30 include_dirs = "${lib.getDev lapack}/include";
31 library_dirs = "${lapack}/lib";
32 runtime_library_dirs = "${lapack}/lib";
35 include_dirs = "${lib.getDev blas}/include";
36 library_dirs = "${blas}/lib";
37 runtime_library_dirs = "${blas}/lib";
41 in buildPythonPackage rec {
44 format = "pyproject.toml";
45 disabled = pythonOlder "3.7";
48 inherit pname version;
50 sha256 = "02m6sms6wb4flfg8y4h0msan4y7w7qgfqxhdk21lcabhm2339iiv";
53 patches = lib.optionals python.hasDistutilsCxxPatch [
54 # We patch cpython/distutils to fix https://bugs.python.org/issue1222585
55 # Patching of numpy.distutils is needed to prevent it from undoing the
57 ./numpy-distutils-C++.patch
60 nativeBuildInputs = [ gfortran cython setuptoolsBuildHook ];
61 buildInputs = [ blas lapack ];
63 # we default openblas to build with 64 threads
64 # if a machine has more than 64 threads, it will segfault
65 # see https://github.com/xianyi/OpenBLAS/issues/2993
67 sed -i 's/-faltivec//' numpy/distutils/system_info.py
68 export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES
69 export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 64 ? 64 : NIX_BUILD_CORES))
76 enableParallelBuilding = true;
78 doCheck = !isPyPy; # numpy 1.16+ hits a bug in pypy's ctypes, using either numpy or pypy HEAD fixes this (https://github.com/numpy/numpy/issues/13807)
88 ${python.interpreter} -c 'import numpy; numpy.test("fast", verbose=10)'
94 # just for backwards compatibility
96 blasImplementation = blas.implementation;
101 # - test_large_file_support: takes a long time and can cause the machine to run out of disk space
102 NOSE_EXCLUDE="test_large_file_support";
105 description = "Scientific tools for Python";
106 homepage = "https://numpy.org/";
107 license = lib.licenses.bsd3;
108 maintainers = with lib.maintainers; [ fridh ];