From d8658fac0f03956c53033a9bb23f8740e1cb9868 Mon Sep 17 00:00:00 2001 From: Eleni Mathioulaki <emathioulaki@athenarc.gr> Date: Sun, 4 Dec 2022 13:31:26 +0100 Subject: [PATCH] modify py-scipy package to solve concretizer issue --- packages/py-scipy/package.py | 124 ++++++++++++++++++++++++++++ packages/py-scipy/scipy-clang.patch | 14 ++++ spack.yaml | 2 +- 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 packages/py-scipy/package.py create mode 100644 packages/py-scipy/scipy-clang.patch diff --git a/packages/py-scipy/package.py b/packages/py-scipy/package.py new file mode 100644 index 00000000..f3290e6e --- /dev/null +++ b/packages/py-scipy/package.py @@ -0,0 +1,124 @@ +# this package was slightly adapted from the spack v0.18.1 upstream because with py-pybind11@2.10.1 +# available, the concretizer selected py-scipy@1.5:1.6.1 +# depends_on('py-pybind11@2.4.3:2.8', when='@1.8:', type=('build', 'link')) +# was changed to +# depends_on('py-pybind11@2.4.3:', when='@1.8:', type=('build', 'link')) + +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +class PyScipy(PythonPackage): + """SciPy (pronounced "Sigh Pie") is a Scientific Library for Python. + It provides many user-friendly and efficient numerical routines such + as routines for numerical integration and optimization.""" + + homepage = "https://www.scipy.org/" + pypi = "scipy/scipy-1.5.4.tar.gz" + git = "https://github.com/scipy/scipy.git" + + maintainers = ['adamjstewart', 'rgommers'] + + version('master', branch='master') + version('1.8.1', sha256='9e3fb1b0e896f14a85aa9a28d5f755daaeeb54c897b746df7a55ccb02b340f33') + version('1.8.0', sha256='31d4f2d6b724bc9a98e527b5849b8a7e589bf1ea630c33aa563eda912c9ff0bd') + version('1.7.3', sha256='ab5875facfdef77e0a47d5fd39ea178b58e60e454a4c85aa1e52fcb80db7babf') + version('1.7.2', sha256='fa2dbabaaecdb502641b0b3c00dec05fb475ae48655c66da16c9ed24eda1e711') + version('1.7.1', sha256='6b47d5fa7ea651054362561a28b1ccc8da9368a39514c1bbf6c0977a1c376764') + version('1.7.0', sha256='998c5e6ea649489302de2c0bc026ed34284f531df89d2bdc8df3a0d44d165739') + version('1.6.3', sha256='a75b014d3294fce26852a9d04ea27b5671d86736beb34acdfc05859246260707') + version('1.6.2', sha256='e9da33e21c9bc1b92c20b5328adb13e5f193b924c9b969cd700c8908f315aa59') + version('1.6.1', sha256='c4fceb864890b6168e79b0e714c585dbe2fd4222768ee90bc1aa0f8218691b11') + version('1.6.0', sha256='cb6dc9f82dfd95f6b9032a8d7ea70efeeb15d5b5fd6ed4e8537bb3c673580566') + version('1.5.4', sha256='4a453d5e5689de62e5d38edf40af3f17560bfd63c9c5bd228c18c1f99afa155b') + version('1.5.3', sha256='ddae76784574cc4c172f3d5edd7308be16078dd3b977e8746860c76c195fa707') + version('1.5.2', sha256='066c513d90eb3fd7567a9e150828d39111ebd88d3e924cdfc9f8ce19ab6f90c9') + version('1.5.1', sha256='039572f0ca9578a466683558c5bf1e65d442860ec6e13307d528749cfe6d07b8') + version('1.5.0', sha256='4ff72877d19b295ee7f7727615ea8238f2d59159df0bdd98f91754be4a2767f0') + version('1.4.1', sha256='dee1bbf3a6c8f73b6b218cb28eed8dd13347ea2f87d572ce19b289d6fd3fbc59') + version('1.4.0', sha256='31f7cfa93b01507c935c12b535e24812594002a02a56803d7cd063e9920d25e8') + version('1.3.3', sha256='64bf4e8ae0db2d42b58477817f648d81e77f0b381d0ea4427385bba3f959380a') + version('1.3.2', sha256='a03939b431994289f39373c57bbe452974a7da724ae7f9620a1beee575434da4') + version('1.3.1', sha256='2643cfb46d97b7797d1dbdb6f3c23fe3402904e3c90e6facfe6a9b98d808c1b5') + version('1.3.0', sha256='c3bb4bd2aca82fb498247deeac12265921fe231502a6bc6edea3ee7fe6c40a7a') + version('1.2.3', sha256='ecbe6413ca90b8e19f8475bfa303ac001e81b04ec600d17fa7f816271f7cca57') + version('1.2.2', sha256='a4331e0b8dab1ff75d2c67b5158a8bb9a83c799d7140094dda936d876c7cfbb1') + version('1.2.1', sha256='e085d1babcb419bbe58e2e805ac61924dac4ca45a07c9fa081144739e500aa3c') + version('1.1.0', sha256='878352408424dffaa695ffedf2f9f92844e116686923ed9aa8626fc30d32cfd1') + version('1.0.0', sha256='87ea1f11a0e9ec08c264dc64551d501fa307289460705f6fccd84cbfc7926d10') + version('0.19.1', sha256='a19a2ca7a7336495ec180adeaa0dfdcf41e96dbbee90d51c3ed828ba570884e6') + version('0.18.1', sha256='8ab6e9c808bf2fb3e8576cd8cf07226d9cdc18b012c06d9708429a821ac6634e') + version('0.17.0', sha256='f600b755fb69437d0f70361f9e560ab4d304b1b66987ed5a28bdd9dd7793e089') + version('0.15.1', sha256='a212cbc3b79e9a563aa45fc5c517b3499198bd7eb7e7be1e047568a5f48c259a') + version('0.15.0', sha256='0c74e31e08acc8bf9b6ceb9bced73df2ae0cc76003e0366350bc7b26292bf8b1') + + # pyproject.toml + depends_on('py-wheel@:0.37', type='build') + depends_on('py-setuptools', type='build') + depends_on('py-setuptools@:51.0.0', when='@1.6', type='build') + depends_on('py-setuptools@:57', when='@1.7', type='build') + depends_on('py-setuptools@:59', when='@1.8:', type='build') + depends_on('py-cython@0.29.18:2', when='@1.7:', type='build') + depends_on('py-pybind11@2.2.4:', when='@1.4.0', type=('build', 'link')) + depends_on('py-pybind11@2.4.0:', when='@1.4.1:1.4', type=('build', 'link')) + depends_on('py-pybind11@2.4.3:', when='@1.5:1.6.1', type=('build', 'link')) + depends_on('py-pybind11@2.4.3:2.6', when='@1.6.2:1.7.1', type=('build', 'link')) + depends_on('py-pybind11@2.4.3:2.7', when='@1.7.2:1.7', type=('build', 'link')) + depends_on('py-pybind11@2.4.3:', when='@1.8:', type=('build', 'link')) + depends_on('py-pythran@0.9.11', when='@1.7.0:1.7.1', type=('build', 'link')) + depends_on('py-pythran@0.9.12:0.9', when='@1.7.2:1.7', type=('build', 'link')) + depends_on('py-pythran@0.10:', when='@1.8:', type=('build', 'link')) + # setup.py + depends_on('py-numpy@1.5.1:+blas+lapack', when='@:0.15', type=('build', 'link', 'run')) + depends_on('py-numpy@1.6.2:+blas+lapack', when='@0.16:0.17', type=('build', 'link', 'run')) + depends_on('py-numpy@1.7.1:+blas+lapack', when='@0.18.0:0.18', type=('build', 'link', 'run')) + depends_on('py-numpy@1.8.2:+blas+lapack', when='@0.19:1.2', type=('build', 'link', 'run')) + depends_on('py-numpy@1.13.3:+blas+lapack', when='@1.3:1.4', type=('build', 'link', 'run')) + depends_on('py-numpy@1.14.5:+blas+lapack', when='@1.5.0:1.5', type=('build', 'link', 'run')) + depends_on('py-numpy@1.16.5:+blas+lapack', when='@1.6:1.6.1', type=('build', 'link', 'run')) + depends_on('py-numpy@1.16.5:1.22+blas+lapack', when='@1.6.2:1.7', type=('build', 'link', 'run')) + depends_on('py-numpy@1.17.3:1.24+blas+lapack', when='@1.8:', type=('build', 'link', 'run')) + depends_on('python@2.6:2.8,3.2:', when='@:0.17', type=('build', 'link', 'run')) + depends_on('python@2.7:2.8,3.4:', when='@0.18:1.2', type=('build', 'link', 'run')) + depends_on('python@3.5:', when='@1.3:1.4', type=('build', 'link', 'run')) + depends_on('python@3.6:', when='@1.5.0:1.5', type=('build', 'link', 'run')) + depends_on('python@3.7:', when='@1.6:1.6.1', type=('build', 'link', 'run')) + depends_on('python@3.7:3.9', when='@1.6.2:1.7.1', type=('build', 'link', 'run')) + depends_on('python@3.7:3.10', when='@1.7.2:1.7', type=('build', 'link', 'run')) + depends_on('python@3.8:3.10', when='@1.8:', type=('build', 'link', 'run')) + depends_on('py-pytest', type='test') + + # NOTE: scipy picks up Blas/Lapack from numpy, see + # http://www.scipy.org/scipylib/building/linux.html#step-4-build-numpy-1-5-0 + depends_on('blas') + depends_on('lapack') + # https://github.com/scipy/scipy/wiki/Dropping-support-for-Accelerate + depends_on('lapack@3.4.1:', when='@1.2:') + + # https://github.com/scipy/scipy/issues/12860 + patch('https://git.sagemath.org/sage.git/plain/build/pkgs/scipy/patches/extern_decls.patch?id=711fe05025795e44b84233e065d240859ccae5bd', + sha256='5433f60831cb554101520a8f8871ac5a32c95f7a971ccd68b69049535b106780', when='@1.2:1.5.3') + + patch('scipy-clang.patch', when='@1.5.0:1.6.3 %clang') + + def setup_build_environment(self, env): + # https://github.com/scipy/scipy/issues/9080 + env.set('F90', spack_fc) + + # https://github.com/scipy/scipy/issues/11611 + if self.spec.satisfies('@:1.4 %gcc@10:'): + env.set('FFLAGS', '-fallow-argument-mismatch') + + def install_options(self, spec, prefix): + args = [] + if spec.satisfies('%fj'): + args.extend(['config_fc', '--fcompiler=fujitsu']) + return args + + @run_after('install') + @on_package_attributes(run_tests=True) + def install_test(self): + with working_dir('spack-test', create=True): + python('-c', 'import scipy; scipy.test("full", verbose=2)') + diff --git a/packages/py-scipy/scipy-clang.patch b/packages/py-scipy/scipy-clang.patch new file mode 100644 index 00000000..5dc19fae --- /dev/null +++ b/packages/py-scipy/scipy-clang.patch @@ -0,0 +1,14 @@ +diff --git a/scipy/special/_faddeeva.cxx b/scipy/special/_faddeeva.cxx +index 9134516..159122c 100644 +--- a/scipy/special/_faddeeva.cxx ++++ b/scipy/special/_faddeeva.cxx +@@ -130,7 +130,7 @@ double faddeeva_voigt_profile(double x, double sigma, double gamma) + + if(sigma == 0){ + if (gamma == 0){ +- if (isnan(x)) ++ if (std::isnan(x)) + return x; + if (x == 0) + return NPY_INFINITY; + diff --git a/spack.yaml b/spack.yaml index fa04410e..c507f2e3 100644 --- a/spack.yaml +++ b/spack.yaml @@ -20,7 +20,7 @@ spack: #- py-version-query # EBRAINS simulators - nest@3.3 +python +gsl +mpi - - arbor@0.8 +python +mpi + - arbor +python +mpi - neuron +mpi - py-pynn@0.10.1 +mpi - py-brian2 -- GitLab