diff --git a/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py b/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py index 4a2dd2e0500..8e2bd4c9ec9 100644 --- a/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py +++ b/var/spack/repos/builtin/packages/py-tensorflow-probability/package.py @@ -17,14 +17,14 @@ class PyTensorflowProbability(Package): predictions.""" homepage = "https://www.tensorflow.org/probability" - url = "https://github.com/tensorflow/probability/archive/v0.12.1.tar.gz" + url = "https://github.com/tensorflow/probability/archive/v0.24.0.tar.gz" maintainers("aweits", "jonas-eschle") license("Apache-2.0") - # tf-keras does not (yet) exist on Spack, i.e. the TF extra won't work, see below - # version("0.24.0", sha256="3d75418cef09ea357ee879347133ab784fe4637a5ba251a8e06ef930dd970a3e") + version("0.25.0", sha256="73cf3e52d3b5ee48fc919631e7fa3621849b8ce8d453017016a5148815856bc2") + version("0.24.0", sha256="3d75418cef09ea357ee879347133ab784fe4637a5ba251a8e06ef930dd970a3e") version("0.23.0", sha256="a00769550da9284acbd69e32a005507153ad39b0c190feca2bbbf6373366cc14") version("0.22.1", sha256="9c1203b454aaeb48ac67dea862a411dba6b04f67c1e874e0e83bd1d7f13829a3") version("0.22.0", sha256="f9ce55b00c8069246d701c04eaafccde413355f6e76ccf9e549772ecfa0349a4") @@ -58,14 +58,11 @@ class PyTensorflowProbability(Package): depends_on("py-dm-tree", when="@0.12:", type=("build", "run")) # tensorflow_probability/python/__init__.py - # TODO: reactivate the JAX versions once the JAX package is available with newer versions - # also add jaxlib as a dependency - - variant("py-tensorflow", default=False, description="Build with TensorFlow support") - with when("+py-tensorflow"): - # TODO(0.24): requires tf-keras on Spack - # depends_on("py-tf-keras", when="@0.24:", type=("build", "run")) - # depends_on("py-tensorflow@2.16", when="@0.24", type=("build", "run")) + variant("tf", default=False, description="Build with TensorFlow support") + with when("+tf"): + depends_on("py-tf-keras@2.18:", when="@0.25:", type=("build", "run")) + depends_on("py-tf-keras@2.17:", when="@0.24:", type=("build", "run")) + depends_on("py-tensorflow@2.17", when="@0.24", type=("build", "run")) depends_on("py-tensorflow@2.15", when="@0.23", type=("build", "run")) depends_on("py-tensorflow@2.14:2", when="@0.22", type=("build", "run")) depends_on("py-tensorflow@2.13:2", when="@0.21", type=("build", "run")) @@ -73,8 +70,13 @@ class PyTensorflowProbability(Package): depends_on("py-tensorflow@2.11:2", when="@0.19", type=("build", "run")) # jaxlib is not required, as it's already a dependency of py-jax - variant("py-jax", default=False, description="Build with JAX support") - with when("+py-jax"): + # no real minimum version, setup.py doesn't specify one. + # The README only specifies that it is "tested and stable against". + # If needed, this versions could be relaxed. + variant("jax", default=False, description="Build with JAX support") + with when("+jax"): + depends_on("py-jax@0.4.35:0.5", when="@0.25", type=("build", "run")) + depends_on("py-jax@0.4.25:0.4", when="@0.24", type=("build", "run")) depends_on("py-jax@0.4.20:0.4", when="@0.23", type=("build", "run")) depends_on("py-jax@0.4.16:0.4", when="@0.22", type=("build", "run")) depends_on("py-jax@0.4.14:0.4", when="@0.21", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-tf-keras/package.py b/var/spack/repos/builtin/packages/py-tf-keras/package.py new file mode 100644 index 00000000000..09095009866 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-tf-keras/package.py @@ -0,0 +1,58 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyTfKeras(PythonPackage): + """The TF-Keras library is a pure TensorFlow implementation of Keras, + based on the legacy tf.keras codebase. Note that the "main" version + of Keras is now Keras 3 (formerly Keras Core), which is a + multi-backend implementation of Keras, supporting JAX, PyTorch, and TensorFlow. + Keras 3 is being developed at keras-team/keras.""" + + homepage = "https://github.com/keras-team/tf-keras" + pypi = "tf-keras/tf_keras-2.18.0.tar.gz" + # url = "https://github.com/keras-team/tf-keras/archive/refs/tags/v2.18.0.tar.gz" + + maintainers("jonas-eschle") + + license("Apache-2.0", checked_by="jonas-eschle") + + max_minor = 18 + # needs TF 2.19: https://github.com/spack/spack/pull/49440 + # version("2.19.0", sha256="b09a407d87a4571ce1e8ca985cfc68483e3d63b2518a5d79a97ad92cb64dbe9c") + version("2.18.0", sha256="ebf744519b322afead33086a2aba872245473294affd40973694f3eb7c7ad77d") + + # Supported Python versions listed in multiple places: + # * tf-keras/tools/pip_package/setup.py + # * CONTRIBUTING.md + # * PKG-INFO + depends_on("python@3.9:", type=("build", "run"), when="@2.17:") + depends_on("py-setuptools", type="build") + + # Required dependencies listed in multiple places: + # * BUILD + # * WORKSPACE + depends_on("py-pandas", type=("build", "run")) + depends_on("py-pydot", type=("build", "run")) + depends_on("py-scipy", type=("build", "run")) + + depends_on("protobuf@3.20.3", type="build", when="@2.18:") + # TODO: uncomment for 2.19 + # depends_on("protobuf@4.23.0", type="build", when="@2.19:") + # the tf-keras versions are following along with TF versions + # as defined in oss_setup.py + for minor_ver in range(18, max_minor + 1): + depends_on(f"py-tensorflow@2.{minor_ver}", type=("build", "run"), when=f"@2.{minor_ver}") + # depends_on(f"py-tensorboard@2.{minor_ver}", + # type=("build", "run"), when=f"@2.{minor_ver}") + depends_on("py-portpicker", type=("build", "run")) + depends_on("py-pyyaml", type=("build", "run")) + depends_on("pil", type=("build", "run")) + depends_on("py-numpy@1.26.0:2.0", type=("build", "run"), when="@2.18:") + + depends_on("py-six", type=("build", "run")) + depends_on("py-absl-py", type=("build", "run")) + depends_on("py-h5py", type=("build", "run"))