From a1d3e0002cf68ea0ba6c2ec0d6aa0e47a2c0da30 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 28 Oct 2023 06:17:32 -0500 Subject: py-numpy: add v1.26 (#40057) --- .../repos/builtin/packages/dxt-explorer/package.py | 2 +- .../repos/builtin/packages/py-gpaw/package.py | 2 +- .../repos/builtin/packages/py-numpy/package.py | 175 +++++++++++++++------ var/spack/repos/builtin/packages/py-pip/package.py | 2 + .../repos/builtin/packages/py-pyfr/package.py | 2 +- .../repos/builtin/packages/py-pyzmq/package.py | 3 + .../repos/builtin/packages/py-scipy/package.py | 170 ++++++++------------ .../repos/builtin/packages/py-tomopy/package.py | 2 +- 8 files changed, 202 insertions(+), 156 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/dxt-explorer/package.py b/var/spack/repos/builtin/packages/dxt-explorer/package.py index 4f7df14c18..90ef648183 100644 --- a/var/spack/repos/builtin/packages/dxt-explorer/package.py +++ b/var/spack/repos/builtin/packages/dxt-explorer/package.py @@ -26,5 +26,5 @@ class DxtExplorer(PythonPackage): depends_on("darshan-util", type=("run")) - depends_on("python@3.6:", type=("build", "run")) + depends_on("py-setuptools", type="build") depends_on("py-pandas", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-gpaw/package.py b/var/spack/repos/builtin/packages/py-gpaw/package.py index 0f5072e927..f6759fb279 100644 --- a/var/spack/repos/builtin/packages/py-gpaw/package.py +++ b/var/spack/repos/builtin/packages/py-gpaw/package.py @@ -35,7 +35,7 @@ class PyGpaw(PythonPackage): depends_on("py-ase@3.19.0:", type=("build", "run"), when="@20.1.0") depends_on("py-ase@3.20.1:", type=("build", "run"), when="@20.10.0") depends_on("py-ase@3.21.0:", type=("build", "run"), when="@21.1.0") - depends_on("py-numpy +blas +lapack", type=("build", "run")) + depends_on("py-numpy", type=("build", "run")) depends_on("py-scipy", type=("build", "run")) depends_on("libxc@3:4.3.4") depends_on("blas") diff --git a/var/spack/repos/builtin/packages/py-numpy/package.py b/var/spack/repos/builtin/packages/py-numpy/package.py index e5ffea879c..8ee118d98e 100644 --- a/var/spack/repos/builtin/packages/py-numpy/package.py +++ b/var/spack/repos/builtin/packages/py-numpy/package.py @@ -5,16 +5,13 @@ import platform import subprocess +from typing import Tuple from spack.package import * class PyNumpy(PythonPackage): - """NumPy is the fundamental package for scientific computing with Python. - It contains among other things: a powerful N-dimensional array object, - sophisticated (broadcasting) functions, tools for integrating C/C++ and - Fortran code, and useful linear algebra, Fourier transform, and random - number capabilities""" + """Fundamental package for array computing in Python.""" homepage = "https://numpy.org/" pypi = "numpy/numpy-1.23.0.tar.gz" @@ -23,6 +20,8 @@ class PyNumpy(PythonPackage): maintainers("adamjstewart", "rgommers") version("main", branch="main") + version("1.26.1", sha256="c8c6c72d4a9f831f328efb1312642a1cafafaa88981d9ab76368d50d07d93cbe") + version("1.26.0", sha256="f93fc78fe8bf15afe2b8d6b6499f1c73953169fad1e9a8dd086cdff3190e7fdf") version("1.25.2", sha256="fd608e19c8d7c55021dffd43bfe5492fab8cc105cc8986f813f8c3c048b38760") version("1.25.1", sha256="9a3a9f3a61480cc086117b426a8bd86869c213fc4072e606f01c4e4b66eb92bf") version("1.25.0", sha256="f1accae9a28dc3cda46a91de86acf69de0d1b5f4edd44a9b0c3ceb8036dfff19") @@ -87,11 +86,8 @@ class PyNumpy(PythonPackage): version("1.14.6", sha256="1250edf6f6c43e1d7823f0967416bc18258bb271dc536298eb0ea00a9e45b80a") version("1.14.5", sha256="a4a433b3a264dbc9aa9c7c241e87c0358a503ea6394f8737df1683c7c9a102ac") - variant("blas", default=True, description="Build with BLAS support") - variant("lapack", default=True, description="Build with LAPACK support") - - # Based on wheel availability on PyPI - depends_on("python@3.9:3.11", when="@1.25:", type=("build", "link", "run")) + depends_on("python@3.9:3.12", when="@1.26:", type=("build", "link", "run")) + depends_on("python@3.9:3.11", when="@1.25", type=("build", "link", "run")) depends_on("python@3.8:3.11", when="@1.23.2:1.24", type=("build", "link", "run")) depends_on("python@3.8:3.10", when="@1.22:1.23.1", type=("build", "link", "run")) depends_on("python@:3.10", when="@1.21.2:1.21", type=("build", "link", "run")) @@ -99,19 +95,30 @@ class PyNumpy(PythonPackage): depends_on("python@:3.8", when="@1.17.3:1.19.2", type=("build", "link", "run")) depends_on("python@:3.7", when="@1.14.5:1.17.2", type=("build", "link", "run")) + depends_on("py-cython@0.29.34:3", when="@1.26:", type="build") + depends_on("py-cython@0.29.34:2", when="@1.25", type="build") + depends_on("py-cython@0.29.30:2", when="@1.22.4:1.24", type="build") + depends_on("py-cython@0.29.24:2", when="@1.21.2:1.22.3", type="build") + depends_on("py-cython@0.29.21:2", when="@1.19.1:1.21.1", type="build") + depends_on("py-cython@0.29.14:2", when="@1.18.1:1.19.0", type="build") + depends_on("py-cython@0.29.13:2", when="@1.18.0", type="build") + depends_on("py-pyproject-metadata@0.7.1:", when="@1.26:", type="build") + depends_on("py-tomli@1:", when="@1.26: ^python@:3.10", type="build") + depends_on("py-setuptools@60:", when="@1.26: ^python@3.12:", type="build") # https://github.com/spack/spack/pull/32078 - depends_on("py-setuptools@:63", type=("build", "run")) + depends_on("py-setuptools@:63", when="@:1.25", type=("build", "run")) depends_on("py-setuptools@:59", when="@:1.22.1", type=("build", "run")) - # Check pyproject.toml for updates to the required cython version - depends_on("py-cython@0.29.34:2", when="@1.25:", type="build") - depends_on("py-cython@0.29.13:2", when="@1.18.0:", type="build") - depends_on("py-cython@0.29.14:2", when="@1.18.1:", type="build") - depends_on("py-cython@0.29.21:2", when="@1.19.1:", type="build") - depends_on("py-cython@0.29.24:2", when="@1.21.2:", type="build") - depends_on("py-cython@0.29.30:2", when="@1.22.4:", type="build") - depends_on("blas", when="+blas") - depends_on("lapack", when="+lapack") + depends_on("py-colorama", when="@1.26: platform=windows", type="build") + + # Required to use --config-settings + depends_on("py-pip@23.1:", when="@1.26:", type="build") + # meson is vendored, ninja and pkgconfig are not + depends_on("ninja@1.8.2:", when="@1.26:", type="build") + depends_on("pkgconfig", when="@1.26:", type="build") + depends_on("blas") + depends_on("lapack") + # test_requirements.txt depends_on("py-nose@1.0.0:", when="@:1.14", type="test") depends_on("py-pytest", when="@1.15:", type="test") depends_on("py-hypothesis", when="@1.19:", type="test") @@ -145,13 +152,21 @@ class PyNumpy(PythonPackage): when="@1.22.0:1.22.3", ) - # version 1.21.0 runs into an infinit loop during printing + # meson.build + # https://docs.scipy.org/doc/scipy/dev/toolchain.html#compilers + conflicts("%gcc@:8.3", when="@1.26:", msg="NumPy requires GCC >= 8.4") + conflicts("%gcc@:4.7", msg="NumPy requires GCC >= 4.8") + conflicts( + "%msvc@:19.19", + when="@1.26:", + msg="NumPy requires at least vc142 (default with Visual Studio 2019) " + "when building with MSVC", + ) + + # version 1.21.0 runs into an infinite loop during printing # (e.g. print(numpy.ones(1000)) when compiled with gcc 11 conflicts("%gcc@11:", when="@1.21.0") - # GCC 4.8 is the minimum version that works - conflicts("%gcc@:4.7", msg="GCC 4.8+ required") - # NVHPC support added in https://github.com/numpy/numpy/pull/17344 conflicts("%nvhpc", when="@:1.19") @@ -159,6 +174,10 @@ class PyNumpy(PythonPackage): conflicts("%intel", when="@1.23.0:1.23.3") conflicts("%oneapi", when="@1.23.0:1.23.3") + @property + def archive_files(self): + return [join_path(self.stage.source_path, "build", "meson-logs", "meson-log.txt")] + def url_for_version(self, version): url = "https://files.pythonhosted.org/packages/source/n/numpy/numpy-{}.{}" if version >= Version("1.23"): @@ -193,16 +212,68 @@ class PyNumpy(PythonPackage): return (flags, None, None) - @run_before("install") - def set_blas_lapack(self): - # https://numpy.org/devdocs/user/building.html - # https://github.com/numpy/numpy/blob/master/site.cfg.example + def blas_lapack_pkg_config(self) -> Tuple[str, str]: + """Convert library names to pkg-config names. - # Skip if no BLAS/LAPACK requested + Returns: + The names of the blas and lapack libs that pkg-config should search for. + """ spec = self.spec - if "+blas" not in spec and "+lapack" not in spec: - return + blas = spec["blas"].libs.names[0] + lapack = spec["lapack"].libs.names[0] + + if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: + blas = "mkl-dynamic-lp64-seq" + if spec["lapack"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: + lapack = "mkl-dynamic-lp64-seq" + + if spec["blas"].name in ["blis", "amdblis"]: + blas = "blis" + + if spec["blas"].name == "cray-libsci": + blas = "libsci" + + if spec["lapack"].name == "cray-libsci": + lapack = "libsci" + + if "armpl" in blas: + if "_mp" in blas: + blas = "armpl-dynamic-lp64-omp" + else: + blas = "armpl-dynamic-lp64-seq" + + if "armpl" in lapack: + if "_mp" in lapack: + lapack = "armpl-dynamic-lp64-omp" + else: + lapack = "armpl-dynamic-lp64-seq" + + return blas, lapack + + @when("@1.26:") + def config_settings(self, spec, prefix): + blas, lapack = self.blas_lapack_pkg_config() + return { + "builddir": "build", + "compile-args": f"-j{make_jobs}", + "setup-args": { + # https://scipy.github.io/devdocs/building/blas_lapack.html + "-Dblas": blas, + "-Dlapack": lapack, + # https://numpy.org/doc/stable/reference/simd/build-options.html + # TODO: get this working in CI + # "-Dcpu-baseline": "native", + # "-Dcpu-dispatch": "none", + }, + } + + def blas_lapack_site_cfg(self) -> None: + """Write a site.cfg file to configure BLAS/LAPACK.""" + spec = self.spec + + # https://numpy.org/doc/1.25/user/building.html + # https://github.com/numpy/numpy/blob/v1.25.2/site.cfg.example def write_library_dirs(f, dirs): f.write("library_dirs = {0}\n".format(dirs)) if not ( @@ -211,17 +282,11 @@ class PyNumpy(PythonPackage): ): f.write("rpath = {0}\n".format(dirs)) - blas_libs = LibraryList([]) - blas_headers = HeaderList([]) - if "+blas" in spec: - blas_libs = spec["blas"].libs - blas_headers = spec["blas"].headers + blas_libs = spec["blas"].libs + blas_headers = spec["blas"].headers - lapack_libs = LibraryList([]) - lapack_headers = HeaderList([]) - if "+lapack" in spec: - lapack_libs = spec["lapack"].libs - lapack_headers = spec["lapack"].headers + lapack_libs = spec["lapack"].libs + lapack_headers = spec["lapack"].headers lapackblas_libs = lapack_libs + blas_libs lapackblas_headers = lapack_headers + blas_headers @@ -334,15 +399,25 @@ class PyNumpy(PythonPackage): write_library_dirs(f, lapack_lib_dirs) f.write("include_dirs = {0}\n".format(lapack_header_dirs)) + @when("@:1.25") + @run_before("install") + def set_blas_lapack(self): + self.blas_lapack_site_cfg() + + @when("@1.26:") + def setup_build_environment(self, env): + # https://github.com/scipy/scipy/issues/19357 + if self.spec.satisfies("%apple-clang@15:"): + env.append_flags("LDFLAGS", "-Wl,-ld_classic") + + @when("@:1.25") def setup_build_environment(self, env): # Tell numpy which BLAS/LAPACK libraries we want to use. - # https://github.com/numpy/numpy/pull/13132 - # https://numpy.org/devdocs/user/building.html#accelerated-blas-lapack-libraries spec = self.spec - # https://numpy.org/devdocs/user/building.html#blas - if "blas" not in spec: - blas = "" - elif ( + # https://github.com/numpy/numpy/pull/13132 + # https://numpy.org/doc/1.25/user/building.html#accelerated-blas-lapack-libraries + # https://numpy.org/doc/1.25/user/building.html#blas + if ( spec["blas"].name == "intel-mkl" or spec["blas"].name == "intel-parallel-studio" or spec["blas"].name == "intel-oneapi-mkl" @@ -361,10 +436,8 @@ class PyNumpy(PythonPackage): env.set("NPY_BLAS_ORDER", blas) - # https://numpy.org/devdocs/user/building.html#lapack - if "lapack" not in spec: - lapack = "" - elif ( + # https://numpy.org/doc/1.25/user/building.html#lapack + if ( spec["lapack"].name == "intel-mkl" or spec["lapack"].name == "intel-parallel-studio" or spec["lapack"].name == "intel-oneapi-mkl" diff --git a/var/spack/repos/builtin/packages/py-pip/package.py b/var/spack/repos/builtin/packages/py-pip/package.py index 52d290d0b5..dfa85d55bc 100644 --- a/var/spack/repos/builtin/packages/py-pip/package.py +++ b/var/spack/repos/builtin/packages/py-pip/package.py @@ -15,6 +15,8 @@ class PyPip(Package, PythonExtension): url = "https://files.pythonhosted.org/packages/py3/p/pip/pip-20.2-py3-none-any.whl" list_url = "https://pypi.org/simple/pip/" + tags = ["build-tools"] + maintainers("adamjstewart", "pradyunsg") version( diff --git a/var/spack/repos/builtin/packages/py-pyfr/package.py b/var/spack/repos/builtin/packages/py-pyfr/package.py index 7cbfe6ab71..9f81ef7597 100644 --- a/var/spack/repos/builtin/packages/py-pyfr/package.py +++ b/var/spack/repos/builtin/packages/py-pyfr/package.py @@ -41,7 +41,7 @@ class PyPyfr(PythonPackage, CudaPackage, ROCmPackage): depends_on("py-h5py@2.10:", type=("build", "run")) depends_on("py-mako@1.0.0:", type=("build", "run")) depends_on("py-mpi4py@3.1.0:", type=("build", "run")) - depends_on("py-numpy@1.20:+blas", type=("build", "run")) + depends_on("py-numpy@1.20:", type=("build", "run")) depends_on("py-platformdirs@2.2.0:", type=("build", "run")) depends_on("py-pytools@2016.2.1:", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-pyzmq/package.py b/var/spack/repos/builtin/packages/py-pyzmq/package.py index 4850dddc08..bf60b4be57 100644 --- a/var/spack/repos/builtin/packages/py-pyzmq/package.py +++ b/var/spack/repos/builtin/packages/py-pyzmq/package.py @@ -45,6 +45,9 @@ class PyPyzmq(PythonPackage): # pyproject.toml depends_on("py-setuptools", type="build") + # https://github.com/zeromq/pyzmq/issues/1278 + # https://github.com/zeromq/pyzmq/pull/1317 + depends_on("py-setuptools@:59", when="@17:18.0", type="build") depends_on("py-packaging", type="build") # setup.py diff --git a/var/spack/repos/builtin/packages/py-scipy/package.py b/var/spack/repos/builtin/packages/py-scipy/package.py index 4a07657d80..51f89f7d4c 100644 --- a/var/spack/repos/builtin/packages/py-scipy/package.py +++ b/var/spack/repos/builtin/packages/py-scipy/package.py @@ -3,16 +3,11 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import glob -import os - from spack.package import * 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.""" + """Fundamental algorithms for scientific computing in Python.""" homepage = "https://www.scipy.org/" pypi = "scipy/scipy-1.10.1.tar.gz" @@ -20,7 +15,9 @@ class PyScipy(PythonPackage): maintainers("adamjstewart", "rgommers") - version("master", branch="master") + version("main", branch="main") + version("master", branch="master", deprecated=True) + version("1.11.3", sha256="bba4d955f54edd61899776bad459bf7326e14b9fa1c552181f0479cc60a568cd") version("1.11.2", sha256="b29318a5e39bd200ca4381d80b065cdf3076c7d7281c5e36569e99273867f61d") version("1.11.1", sha256="fb5b492fa035334fd249f0973cc79ecad8b09c604b42a127a677b45a9a3d4289") version("1.11.0", sha256="f9b0248cb9d08eead44cde47cbf6339f1e9aa0dfde28f5fb27950743e317bd5d") @@ -65,22 +62,18 @@ class PyScipy(PythonPackage): depends_on("python@:3.8", when="@1.3.2:1.5.3", type=("build", "link", "run")) depends_on("python@:3.7", when="@1.1:1.3.1", type=("build", "link", "run")) - # TODO: remove once pip build supports BLAS/LAPACK specification - # https://github.com/mesonbuild/meson-python/pull/167 - depends_on("py-build", when="@1.9:", type="build") - - depends_on("py-meson-python@0.12.1:0.13", when="@1.11:", type="build") - depends_on("py-meson-python@0.11:0.12", when="@1.10.1:1.10", type="build") - depends_on("py-meson-python@0.11", when="@1.10.0", type="build") - depends_on("py-meson-python@0.9:", when="@1.9.2:1.9", type="build") - depends_on("py-meson-python@0.8.1:", when="@1.9.1", type="build") - depends_on("py-meson-python@0.7", when="@1.9.0", type="build") - depends_on("meson@0.62.2", when="@1.9.0:1.9.1", type="build") + depends_on("py-meson-python@0.12.1:", when="@1.11:", type="build") + depends_on("py-meson-python@0.11:", when="@1.10:", type="build") + depends_on("py-meson-python@0.9:", when="@1.9.2:", type="build") + depends_on("py-meson-python@0.8.1:", when="@1.9.1:", type="build") + depends_on("py-meson-python@0.7:", when="@1.9:", type="build") + depends_on("meson", when="@1.9.0:1.9.1", type="build") depends_on("py-cython@0.29.35:2", when="@1.11:", type="build") depends_on("py-cython@0.29.32:2", when="@1.9.2:", type="build") depends_on("py-cython@0.29.21:2", when="@1.9:", type="build") depends_on("py-cython@0.29.18:2", when="@1.7:", type="build") - depends_on("py-pybind11@2.10.4:2.10", when="@1.11:", type=("build", "link")) + depends_on("py-pybind11@2.10.4:2.11.0", when="@1.11.3:", type=("build", "link")) + depends_on("py-pybind11@2.10.4:2.10", when="@1.11.0:1.11.2", type=("build", "link")) depends_on("py-pybind11@2.10.1", when="@1.10", type=("build", "link")) depends_on("py-pybind11@2.4.3:2.10", when="@1.9.1:1.9", type=("build", "link")) depends_on("py-pybind11@2.4.3:2.9", when="@1.9.0", type=("build", "link")) @@ -90,14 +83,11 @@ class PyScipy(PythonPackage): depends_on("py-pybind11@2.4.3:", when="@1.5:1.6.1", type=("build", "link")) depends_on("py-pybind11@2.4.0:", when="@1.4.1:1.4", type=("build", "link")) depends_on("py-pybind11@2.2.4:", when="@1.4.0", type=("build", "link")) - depends_on("py-pythran@0.12:0.13", when="@1.11:", type="build") - depends_on("py-pythran@0.12", when="@1.10", type="build") - depends_on("py-pythran@0.9.12:0.12", when="@1.9.2:1.9", type="build") - depends_on("py-pythran@0.9.12:0.11", when="@1.9.0:1.9.1", type="build") - depends_on("py-pythran@0.10", when="@1.8", type="build") - depends_on("py-pythran@0.9.12:0.9", when="@1.7.2:1.7", type="build") - depends_on("py-pythran@0.9.11", when="@1.7.0:1.7.1", type="build") - depends_on("py-wheel@:0.40", when="@1.11:", type="build") + depends_on("py-pythran@0.12:", when="@1.10:", type="build") + depends_on("py-pythran@0.10:", when="@1.8", type="build") + depends_on("py-pythran@0.9.12:", when="@1.7.2:", type="build") + depends_on("py-pythran@0.9.11:", when="@1.7:", type="build") + depends_on("py-wheel@:0.40", when="@1.11.0:1.11.2", type="build") depends_on("py-wheel@:0.38", when="@1.10", type="build") depends_on("py-wheel@:0.37", when="@:1.9", type="build") depends_on("pkgconfig", when="@1.9:", type="build") @@ -105,43 +95,53 @@ class PyScipy(PythonPackage): depends_on("py-setuptools@:59", when="@1.8", type="build") depends_on("py-setuptools@:57", when="@1.7", type="build") depends_on("py-setuptools@:51.0.0", when="@1.6", type="build") - depends_on("py-numpy@1.21.6:1.27+blas+lapack", when="@1.11:", type=("build", "link", "run")) - depends_on("py-numpy@1.19.5:1.26+blas+lapack", when="@1.10", type=("build", "link", "run")) - depends_on("py-numpy@1.18.5:1.25+blas+lapack", when="@1.9", type=("build", "link", "run")) - depends_on("py-numpy@1.17.3:1.24+blas+lapack", when="@1.8", 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.16.5:+blas+lapack", when="@1.6:1.6.1", 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.13.3:+blas+lapack", when="@1.3:1.4", type=("build", "link", "run")) - depends_on("py-numpy@1.8.2:+blas+lapack", when="@:1.2", type=("build", "link", "run")) + depends_on("py-numpy@1.21.6:1.27", when="@1.11:", type=("build", "link", "run")) + depends_on("py-numpy@1.19.5:1.26", when="@1.10", type=("build", "link", "run")) + depends_on("py-numpy@1.18.5:1.25", when="@1.9", type=("build", "link", "run")) + depends_on("py-numpy@1.17.3:1.24", when="@1.8", type=("build", "link", "run")) + depends_on("py-numpy@1.16.5:1.22", when="@1.6:1.7", type=("build", "link", "run")) + depends_on("py-numpy@1.14.5:1.21", when="@1.5", type=("build", "link", "run")) + depends_on("py-numpy@1.13.3:1.21", when="@1.3:1.4", type=("build", "link", "run")) + depends_on("py-numpy@1.8.2:1.20", when="@:1.2", type=("build", "link", "run")) depends_on("py-pytest", type="test") - # NOTE: scipy should use the same BLAS/LAPACK as numpy. - # For scipy 1.8 and older, this is achieved by calling the set_blas_lapack() - # and setup_build_environment() from numpy in the scipy spec. - depends_on("blas") - depends_on("lapack") + # Required to use --config-settings + depends_on("py-pip@23.1:", when="@1.9:", type="build") # https://docs.scipy.org/doc/scipy/dev/toolchain.html#other-libraries depends_on("lapack@3.7.1:", when="@1.9:") depends_on("lapack@3.4.1:", when="@1.2:") + depends_on("lapack") + depends_on("blas") + # meson.build # https://docs.scipy.org/doc/scipy/dev/toolchain.html#compilers - conflicts("%gcc@:7", when="@1.10:") - conflicts("%gcc@:4.7", when="@:1.9") - conflicts("%apple-clang@:9", when="@1.10:") - conflicts("%msvc@:19.19", when="@1.10:") + conflicts("%gcc@:7", when="@1.10:", msg="SciPy requires GCC >= 8.0") + conflicts("%gcc@:4.7", when="@:1.9", msg="SciPy requires GCC >= 4.8") + conflicts( + "%msvc@:19.19", + when="@1.10:", + msg="SciPy requires at least vc142 (default with Visual Studio 2019) " + "when building with MSVC", + ) - # https://github.com/scipy/scipy/pull/11324 - conflicts("@1.4.0:1.4.1", when="target=ppc64le:") + # https://github.com/scipy/scipy/issues/19352 + conflicts("^py-cython@3.0.3") # https://github.com/mesonbuild/meson/pull/10909#issuecomment-1282241479 # Intel OneAPI ifx claims to support -fvisibility, but this does not work. # Meson adds this flag for all Python extensions which include Fortran code. conflicts("%oneapi@:2023.0", when="@1.9:") + # error: expected unqualified-id (exact compiler versions unknown) + conflicts("%apple-clang@15:", when="@:1.9") + + # https://docs.scipy.org/doc//scipy-1.10.1/release.1.7.3.html + conflicts("platform=darwin target=aarch64:", when="@:1.7.2") + + # https://github.com/scipy/scipy/pull/11324 + conflicts("@1.4.0:1.4.1", when="target=ppc64le:") + # https://github.com/scipy/scipy/issues/12860 patch( "https://git.sagemath.org/sage.git/plain/build/pkgs/scipy/patches/extern_decls.patch?id=711fe05025795e44b84233e065d240859ccae5bd", @@ -155,12 +155,6 @@ class PyScipy(PythonPackage): def archive_files(self): return [join_path(self.stage.source_path, "build", "meson-logs", "meson-log.txt")] - @run_before("install") - def set_blas_lapack(self): - # Pick up BLAS/LAPACK from numpy - if self.spec.satisfies("@:1.8"): - self.spec["py-numpy"].package.set_blas_lapack() - @run_before("install") def set_fortran_compiler(self): if self.compiler.f77 is None or self.compiler.fc is None: @@ -200,53 +194,27 @@ class PyScipy(PythonPackage): if self.spec.satisfies("@:1.8"): self.spec["py-numpy"].package.setup_build_environment(env) - # TODO: remove once pip build supports BLAS/LAPACK specification - # https://github.com/mesonbuild/meson-python/pull/167 + # https://github.com/scipy/scipy/issues/19357 + if self.spec.satisfies("%apple-clang@15:"): + env.append_flags("LDFLAGS", "-Wl,-ld_classic") + @when("@1.9:") - def install(self, spec, prefix): - blas = spec["blas"].libs.names[0] - lapack = spec["lapack"].libs.names[0] - if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: - blas = "mkl-dynamic-lp64-seq" - if spec["lapack"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: - lapack = "mkl-dynamic-lp64-seq" - if spec["blas"].name in ["blis", "amdblis"]: - blas = "blis" - if "armpl" in blas: - if "_mp" in blas: - blas = "armpl-dynamic-lp64-omp" - else: - blas = "armpl-dynamic-lp64-seq" - if "armpl" in lapack: - if "_mp" in lapack: - lapack = "armpl-dynamic-lp64-omp" - else: - lapack = "armpl-dynamic-lp64-seq" - - args = [ - "setup", - "build", - "-Dblas=" + blas, - "-Dlapack=" + lapack, - "--prefix=" + join_path(os.getcwd(), "build-install"), - "-Ddebug=false", - "-Doptimization=2", - ] - meson = which("meson") - meson(*args) - args = [ - "-m", - "build", - "--wheel", - "-Cbuilddir=build", - "--no-isolation", - "--skip-dependency-check", - "-Ccompile-args=-j%s" % make_jobs, - ".", - ] - python(*args) - args = std_pip_args + ["--prefix=" + prefix, glob.glob(join_path("dist", "scipy*.whl"))[0]] - pip(*args) + def config_settings(self, spec, prefix): + blas, lapack = self.spec["py-numpy"].package.blas_lapack_pkg_config() + return { + "builddir": "build", + "compile-args": f"-j{make_jobs}", + "setup-args": { + # http://scipy.github.io/devdocs/building/blas_lapack.html + "-Dblas": blas, + "-Dlapack": lapack, + }, + } + + @when("@:1.8") + @run_before("install") + def set_blas_lapack(self): + self.spec["py-numpy"].package.blas_lapack_site_cfg() @run_after("install") @on_package_attributes(run_tests=True) diff --git a/var/spack/repos/builtin/packages/py-tomopy/package.py b/var/spack/repos/builtin/packages/py-tomopy/package.py index b99e60ef91..59a1c0f1b3 100644 --- a/var/spack/repos/builtin/packages/py-tomopy/package.py +++ b/var/spack/repos/builtin/packages/py-tomopy/package.py @@ -34,7 +34,7 @@ class PyTomopy(PythonPackage): # Note: The module name of py-scikit-build is skbuild: depends_on("py-scikit-build", type=("build")) depends_on("py-scikit-image@0.17:", type=("build", "run")) - depends_on("py-numpy+blas", type=("build", "run")) + depends_on("py-numpy", type=("build", "run")) depends_on("py-pyfftw", type=("build", "run"), when="@1.0:1.9") depends_on("py-scipy", type=("build", "run")) depends_on("py-setuptools", type="build") -- cgit v1.2.3-60-g2f50