Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchPypi 4, python 5, pythonOlder 6, buildPythonPackage 7, cython 8, gfortran 9, meson-python 10, pkg-config 11, pythran 12, wheel 13, nose 14, pytest 15, pytest-xdist 16, numpy 17, pybind11 18, pooch 19, libxcrypt 20}: 21 22buildPythonPackage rec { 23 pname = "scipy"; 24 version = "1.10.1"; 25 format = "pyproject"; 26 27 src = fetchPypi { 28 inherit pname version; 29 hash = "sha256-LPnfuAp7RYm6TEDOdYiYbW1c68VFfK0sKID2vC1C86U="; 30 }; 31 32 patches = [ 33 # These tests require internet connection, currently impossible to disable 34 # them otherwise, see: 35 # https://github.com/scipy/scipy/pull/17965 36 ./disable-datasets-tests.patch 37 ]; 38 39 nativeBuildInputs = [ cython gfortran meson-python pythran pkg-config wheel ]; 40 41 buildInputs = [ 42 numpy.blas 43 pybind11 44 pooch 45 ] ++ lib.optionals (pythonOlder "3.9") [ 46 libxcrypt 47 ]; 48 49 propagatedBuildInputs = [ numpy ]; 50 51 nativeCheckInputs = [ nose pytest pytest-xdist ]; 52 53 doCheck = !(stdenv.isx86_64 && stdenv.isDarwin); 54 55 preConfigure = '' 56 sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py 57 export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES 58 ''; 59 60 # disable stackprotector on aarch64-darwin for now 61 # 62 # build error: 63 # 64 # /private/tmp/nix-build-python3.9-scipy-1.6.3.drv-0/ccDEsw5U.s:109:15: error: index must be an integer in range [-256, 255]. 65 # 66 # ldr x0, [x0, ___stack_chk_guard];momd 67 # 68 hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; 69 70 checkPhase = '' 71 runHook preCheck 72 pushd "$out" 73 export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 )) 74 ${python.interpreter} -c "import scipy; scipy.test('fast', verbose=10, parallel=$NIX_BUILD_CORES)" 75 popd 76 runHook postCheck 77 ''; 78 79 requiredSystemFeatures = [ "big-parallel" ]; # the tests need lots of CPU time 80 81 passthru = { 82 blas = numpy.blas; 83 }; 84 85 setupPyBuildFlags = [ "--fcompiler='gnu95'" ]; 86 87 SCIPY_USE_G77_ABI_WRAPPER = 1; 88 89 meta = with lib; { 90 description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering"; 91 homepage = "https://www.scipy.org/"; 92 license = licenses.bsd3; 93 maintainers = [ maintainers.fridh ]; 94 }; 95}