1{lib, fetchPypi, python, buildPythonPackage, isPy27, isPyPy, gfortran, nose, blas}:
2
3buildPythonPackage rec {
4 pname = "numpy";
5 version = "1.14.0";
6 name = "${pname}-${version}";
7
8 src = fetchPypi {
9 inherit pname version;
10 extension = "zip";
11 sha256 = "3de643935b212307b420248018323a44ec51987a336d1d747c1322afc3c099fb";
12 };
13
14 disabled = isPyPy;
15 buildInputs = [ gfortran nose blas ];
16
17 patches = lib.optionals (python.hasDistutilsCxxPatch or false) [
18 # See cpython 2.7 patches.
19 # numpy.distutils is used by cython during it's check phase
20 ./numpy-distutils-C++.patch
21 ];
22
23 preConfigure = ''
24 sed -i 's/-faltivec//' numpy/distutils/system_info.py
25 export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES
26 '';
27
28 preBuild = ''
29 echo "Creating site.cfg file..."
30 cat << EOF > site.cfg
31 [openblas]
32 include_dirs = ${blas}/include
33 library_dirs = ${blas}/lib
34 EOF
35 '';
36
37 enableParallelBuilding = true;
38
39 checkPhase = ''
40 runHook preCheck
41 pushd dist
42 ${python.interpreter} -c 'import numpy; numpy.test("fast", verbose=10)'
43 popd
44 runHook postCheck
45 '';
46
47 postInstall = ''
48 ln -s $out/bin/f2py* $out/bin/f2py
49 '';
50
51 passthru = {
52 blas = blas;
53 };
54
55 # Disable two tests
56 # - test_f2py: f2py isn't yet on path.
57 # - test_large_file_support: takes a long time and can cause the machine to run out of disk space
58 NOSE_EXCLUDE="test_f2py,test_large_file_support";
59
60 meta = {
61 description = "Scientific tools for Python";
62 homepage = http://numpy.scipy.org/;
63 maintainers = with lib.maintainers; [ fridh ];
64 };
65}