From 5ae7066bfe85a27b6a90c2148c8c86d8f09ae596 Mon Sep 17 00:00:00 2001 From: Isidor Zeuner Date: Fri, 1 Nov 2024 09:08:11 +0100 Subject: [PATCH] libtensorflow: libtensorflow: 2.14.0 -> 2.15.0 --- .../tensorflow/compute-links.patch | 14 --- .../tensorflow/compute-relative.sh | 12 --- .../tensorflow/core-riegeli-proto.patch | 11 +++ .../core-rules-python-use-nix.patch | 11 +-- .../python-modules/tensorflow/default.nix | 98 ++++++++----------- .../tensorflow/fix-syslib-references.patch | 6 +- .../tensorflow/protobuf_cc_toolchain.patch | 27 +++++ .../tensorflow/protobuf_lite.patch | 16 +++ .../tensorflow/riegeli-proto.patch | 36 +++++++ .../rules-python-newer-versions.patch | 56 ----------- .../tensorflow/rules-python-use-nix.patch | 28 +++++- pkgs/top-level/python-packages.nix | 30 ------ 12 files changed, 165 insertions(+), 180 deletions(-) delete mode 100644 pkgs/development/python-modules/tensorflow/compute-links.patch delete mode 100644 pkgs/development/python-modules/tensorflow/compute-relative.sh create mode 100644 pkgs/development/python-modules/tensorflow/core-riegeli-proto.patch create mode 100644 pkgs/development/python-modules/tensorflow/protobuf_cc_toolchain.patch create mode 100644 pkgs/development/python-modules/tensorflow/protobuf_lite.patch create mode 100644 pkgs/development/python-modules/tensorflow/riegeli-proto.patch delete mode 100644 pkgs/development/python-modules/tensorflow/rules-python-newer-versions.patch diff --git a/pkgs/development/python-modules/tensorflow/compute-links.patch b/pkgs/development/python-modules/tensorflow/compute-links.patch deleted file mode 100644 index f2864123087714..00000000000000 --- a/pkgs/development/python-modules/tensorflow/compute-links.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naurd x/tensorflow/tensorflow.bzl y/tensorflow/tensorflow.bzl ---- x/tensorflow/tensorflow.bzl 2023-12-13 21:33:03.430643611 +0000 -+++ y/tensorflow/tensorflow.bzl 2023-12-15 17:24:41.445609613 +0000 -@@ -960,8 +960,9 @@ - outs = [src], - srcs = [dest], - output_to_bindir = 1, -- cmd = "ln -sf $$(realpath --relative-to=$(RULEDIR) $<) $@", -+ cmd = "ln -sf $$($(location :compute-relative.sh) $(RULEDIR) $<) $@", - visibility = visibility, -+ tools = [":compute-relative.sh"], - ) - - def _get_shared_library_name_os_version_matrix(name, per_os_targets = False, version = None): diff --git a/pkgs/development/python-modules/tensorflow/compute-relative.sh b/pkgs/development/python-modules/tensorflow/compute-relative.sh deleted file mode 100644 index dab051a48e0ae8..00000000000000 --- a/pkgs/development/python-modules/tensorflow/compute-relative.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!@bash@ -base="$1/" -target="$2" -while true - do echo "$base" | grep -q / || break - base_component="`echo "$base" | sed s,/.*,,`" - target_component="`echo "$target" | sed s,/.*,,`" - test "X$base_component" != "X$target_component" && break - base="`echo "$base" | sed "s<^$base_component/<<"`" - target="`echo "$target" | sed "s<^$target_component/<<"`" -done -echo "$target" diff --git a/pkgs/development/python-modules/tensorflow/core-riegeli-proto.patch b/pkgs/development/python-modules/tensorflow/core-riegeli-proto.patch new file mode 100644 index 00000000000000..8129b0119bd71f --- /dev/null +++ b/pkgs/development/python-modules/tensorflow/core-riegeli-proto.patch @@ -0,0 +1,11 @@ +diff -Naurd x/tensorflow/workspace2.bzl y/tensorflow/workspace2.bzl +--- x/tensorflow/workspace2.bzl 2023-12-07 09:42:06.557980143 +0000 ++++ y/tensorflow/workspace2.bzl 2023-12-07 09:43:50.613924139 +0000 +@@ -862,6 +862,7 @@ + tf_http_archive( + name = "riegeli", + sha256 = "870ca080cdfc5eba696a72ccc3a54cbf0f2271befc0d459eafa8f065edfaadb2", ++ patch_file = ["//third_party:riegeli-proto.patch"], + strip_prefix = "riegeli-264ef7b4a1314d97265b37544b27cd3923ea72d2", + urls = tf_mirror_urls("https://github.com/google/riegeli/archive/264ef7b4a1314d97265b37544b27cd3923ea72d2.zip"), + ) diff --git a/pkgs/development/python-modules/tensorflow/core-rules-python-use-nix.patch b/pkgs/development/python-modules/tensorflow/core-rules-python-use-nix.patch index 2a20d1c5dc72d8..366d1d5937bb43 100644 --- a/pkgs/development/python-modules/tensorflow/core-rules-python-use-nix.patch +++ b/pkgs/development/python-modules/tensorflow/core-rules-python-use-nix.patch @@ -1,13 +1,12 @@ diff -Naurd x/WORKSPACE y/WORKSPACE --- x/WORKSPACE 2023-11-16 08:55:37.370373002 +0000 +++ y/WORKSPACE 2023-11-20 01:55:57.812931627 +0000 -@@ -17,6 +17,10 @@ - sha256 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841", - strip_prefix = "rules_python-0.23.1", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz", +@@ -17,6 +17,9 @@ + sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b", + strip_prefix = "rules_python-0.26.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz", + patches = [ -+ "//tensorflow:rules-python-use-nix.patch", -+ "//tensorflow:rules-python-newer-versions.patch", ++ "//tensorflow:rules-python-use-nix.patch" + ], ) diff --git a/pkgs/development/python-modules/tensorflow/default.nix b/pkgs/development/python-modules/tensorflow/default.nix index f81b5d19596a08..edd93459d12266 100644 --- a/pkgs/development/python-modules/tensorflow/default.nix +++ b/pkgs/development/python-modules/tensorflow/default.nix @@ -192,7 +192,7 @@ let tfFeature = x: if x then "1" else "0"; - version = "2.14.0"; + version = "2.15.0"; format = "setuptools"; variant = lib.optionalString cudaSupport "-gpu"; pname = "tensorflow${variant}"; @@ -467,6 +467,22 @@ let ''; }; + wrapt-bazel = stdenv.mkDerivation { + name = "${wrapt.pname}-bazel-${wrapt.version}"; + src = _bazel-build.deps; + dontConfigure = true; + dontBuild = true; + installPhase = '' + runHook preInstall + mkdir $out + cp pypi_wrapt/* $out + mkdir $out/site-packages + ${lndir}/bin/lndir ${wrapt}/lib/python${python_dotted}/site-packages \ + $out/site-packages + runHook postInstall + ''; + }; + markupsafe-bazel = stdenv.mkDerivation { name = "${markupsafe.pname}-bazel-${markupsafe.version}"; src = _bazel-build.deps; @@ -609,6 +625,7 @@ let "--override_repository=pypi_numpy=${numpy-bazel}" "--override_repository=pypi_grpcio=${grpcio-bazel}" "--override_repository=pypi_h5py=${h5py-bazel}" + "--override_repository=pypi_wrapt=${wrapt-bazel}" "--override_repository=pypi_markupsafe=${markupsafe-bazel}" "--override_repository=pypi=${pypi-bazel}" "--override_repository=python=${python-bazel}" @@ -631,7 +648,7 @@ let owner = "tensorflow"; repo = "tensorflow"; rev = "refs/tags/v${version}"; - hash = "sha256-OvYb1YkYT9xeUGz3yBRdgNd/0s4YNhXPlw7yOR7pxB0="; + hash = "sha256-tCFLEvJ1lHy7NcHDW9Dkd+2D60x+AvOB8EAwmUSQCtM="; }; # On update, it can be useful to steal the changes from gentoo @@ -726,7 +743,6 @@ let "jsoncpp_git" "libjpeg_turbo" "nasm" - "opt_einsum_archive" "org_sqlite" "pasta" "png" @@ -782,27 +798,22 @@ let url = "https://raw.githubusercontent.com/conda-forge/tensorflow-feedstock/0a63c5a962451b4da99a9948323d8b3ed462f461/recipe/patches/0001-Omit-linking-to-layout_proto_cc-if-protobuf-linkage-.patch"; hash = "sha256-/7buV6DinKnrgfqbe7KKSh9rCebeQdXv2Uj+Xg/083w="; }) - (fetchpatch { - name = "fix-clang16-build.patch"; - url = "https://github.com/tensorflow/tensorflow/commit/055b7147a436360110480ba1ef97f4216e1909d8.diff"; - hash = "sha256-3eLmKMjcbYrb/RnpEuCYj4iOK4iMs3IVy976ruKPmTk="; - }) (fetchpatch { url = "https://github.com/openxla/xla/commit/30c1666bf76616b6d6569a262a6cc705b3ce5f47.diff"; name = "denormal-cstdint.patch"; - stripLen = 3; - extraPrefix = "tensorflow/"; - decode = "sed 's<\"tsl/<\"tensorflow/tsl/<'"; - hash = "sha256-Dm3NoEvChdNolunLIDlyD1anwtUlbnfBT4GBj2w0caM="; + stripLen = 1; + extraPrefix = "third_party/xla/"; + hash = "sha256-kOXFVFM3Z1945gLoJhTiCvriiWTzlGcm92URWasO5hM="; }) ./fix-syslib-references.patch + ./protobuf_lite.patch + ./protobuf_cc_toolchain.patch ./pybind11-osx.patch ./com_google_absl_add_log.patch + ./core-riegeli-proto.patch ./protobuf_python.patch ./pybind11_protobuf_python_runtime_dep.patch ./pybind11_protobuf_newer_version.patch - # the implementation from upstream using realpath breaks in the sandbox - ./compute-links.patch ./add-python-312.patch ] ++ lib.optionals (!stdenv.isDarwin) [ @@ -819,35 +830,11 @@ let # bazel 3.3 should work just as well as bazel 3.1 rm -f .bazelversion patchShebangs . - sed 's,@bash@,${stdenv.shell},g' < ${./compute-relative.sh} \ - > tensorflow/compute-relative.sh - chmod +x tensorflow/compute-relative.sh + ln -s ${./riegeli-proto.patch} third_party/riegeli-proto.patch ! test -e requirements_lock_3_12.txt cp requirements_lock_3_11.txt requirements_lock_3_12.txt substituteInPlace requirements_lock_*.txt \ '' - + lib.optionalString (stdenv.isx86_64) '' - --replace-fail \ - "00258cbe3f5188629828363ae8ff78477ce976a6f63fb2bb5e90088396faa82e" \ - "5711c51e204dc52065f4a3327dca46e69636a0b76d3e98c2c28c4ccef9b04c52" \ - --replace-fail \ - "092fa155b945015754bdf988be47793c377b52b88d546e45c6a9f9579ac7f7b6" \ - "956f0b7cb465a65de1bd90d5a7475b4dc55089b25042fe0f6c870707e9aabb1d" \ - --replace-fail \ - "2313b124e475aa9017a9844bdc5eafb2d5abdda9d456af16fc4535408c7d6da6" \ - "d0fcf53df684fcc0154b1e61f6b4a8c4cf5f49d98a63511e3f30966feff39cd0" \ - '' - + lib.optionalString (!stdenv.isx86_64) '' - --replace-fail \ - "0f80bf37f09e1caba6a8063e56e2b87fa335add314cf2b78ebf7cb45aa7e3d06" \ - "2f120d27051e4c59db2f267b71b833796770d3ea36ca712befa8c5fff5da6ebd" \ - --replace-fail \ - "20ec6fc4ad47d1b6e12deec5045ec3cd5402d9a1597f738263e98f490fe07056" \ - "0b84445fa94d59e6806c10266b977f92fa997db3585f125d6b751af02ff8b9fe" \ - '' - + '' - --replace-fail "grpcio==1.57.0" "grpcio==1.59.0" \ - '' + lib.optionalString (stdenv.isx86_64) '' --replace-fail \ "0cbe9848fad08baf71de1a39e12d1b6310f1d5b2d0ea4de051058e6e1076852d" \ @@ -865,14 +852,13 @@ let "9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b" \ '' + '' - --replace-fail "numpy==1.23.5" "numpy==1.26.4" - cp ${./rules-python-newer-versions.patch} \ - tensorflow/rules-python-newer-versions.patch + --replace-fail "numpy==1.23.5" "numpy==1.26.4" '' + lib.optionalString (!stdenv.isDarwin) '' sed \ -e 's,@python@,${pythonEnv},g' \ -e 's,@python_version@,${python.version},g' \ + -e 's,@version_long@,${python_dotted},g' \ < ${./rules-python-use-nix.patch} \ > tensorflow/rules-python-use-nix.patch '' @@ -892,9 +878,6 @@ let --replace-fail '"@ml_dtypes//:LICENSE",' "" ''; - # https://github.com/tensorflow/tensorflow/pull/39470 - env.NIX_CFLAGS_COMPILE = toString [ "-Wno-stringop-truncation" ]; - preConfigure = let opt_flags = @@ -966,6 +949,7 @@ let rm -f external/pypi_numpy/rules_python_wheel_entry_point_f2py${python_dotted}.py rm -rf external/pypi_grpcio/site-packages rm -rf external/pypi_h5py/site-packages + rm -rf external/pypi_wrapt/site-packages rm -rf external/pypi_markupsafe/site-packages substituteInPlace external/pypi/requirements.bzl \ --replace-fail ${python_underscored} @version_underscored@ @@ -981,7 +965,10 @@ let rm -rf external/python_*-unknown-linux-gnu/share substituteInPlace external/python_*-unknown-linux-gnu/BUILD.bazel \ --replace-fail python${python_dotted} python@version_long@ \ - --replace-fail python${python_undotted} python@version_short@ + --replace-fail python${python_undotted} python@version_short@ \ + --replace-fail \ + 'python_version = "${python_dotted}"' \ + 'python_version = "@version_long@"' substituteInPlace external/rules_python/python/repositories.bzl \ --replace-fail ${pythonEnv} @python@ \ --replace-fail ${python.version} @python_version@ @@ -992,14 +979,14 @@ let { x86_64-linux = if cudaSupport then - "sha256-Kf8V2526As9AF8J0t1MRPLl0YaUG3H5Dxe53UEsQd04=" + "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" else - "sha256-2irYKdPaDhSDVOrgPv7oQKHaiEv5UtSZnzXnoKkDKAk="; + "sha256-15g0FJ3moJ24RCJt5EHhZsCwLdPNkZ86bod3Mc2AG7A="; aarch64-linux = if cudaSupport then "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" else - "sha256-Vu4pk5J98zTHBzyLSHdaioqo64cnfCfRQHUX91wEbgM="; + "sha256-aGYURdMbxbamOBIC4yaV07HoR+86ILOgdS7cUBzPrkw="; # deps hashes can't be computed for the Darwin platforms as of # 2024-10-21 as the expressions don't evaluate due to # python3Packages.jaraco-path being broken on these platforms @@ -1089,10 +1076,6 @@ buildPythonPackage { src = bazel-build.python; - patches = [ - ./remove-keras-dependency.patch - ]; - # Adjust dependency requirements: # - Drop tensorflow-io dependency until we get it to build # - Relax flatbuffers and gast version requirements @@ -1144,7 +1127,13 @@ buildPythonPackage { wrapt ] ++ lib.optionals withTensorboard [ tensorboard ]; - nativeBuildInputs = lib.optionals cudaSupport [ addDriverRunpath ]; + nativeBuildInputs = + [ + pythonRelaxDepsHook + ] + ++ lib.optionals cudaSupport [ + addDriverRunpath + ]; postFixup = lib.optionalString cudaSupport ( '' @@ -1193,7 +1182,6 @@ buildPythonPackage { passthru = { deps = bazel-build.deps; libtensorflow = bazel-build.out; - ml-dtypesTF = ml-dtypes; }; inherit (bazel-build) meta; diff --git a/pkgs/development/python-modules/tensorflow/fix-syslib-references.patch b/pkgs/development/python-modules/tensorflow/fix-syslib-references.patch index beb3ec08b0e9ad..95e3b85b0a08be 100644 --- a/pkgs/development/python-modules/tensorflow/fix-syslib-references.patch +++ b/pkgs/development/python-modules/tensorflow/fix-syslib-references.patch @@ -1,12 +1,12 @@ diff -Naurd x/tensorflow/tools/pip_package/BUILD y/tensorflow/tools/pip_package/BUILD --- x/tensorflow/tools/pip_package/BUILD 2023-10-14 20:09:43.001857258 +0000 +++ y/tensorflow/tools/pip_package/BUILD 2023-10-14 20:15:17.894102008 +0000 -@@ -208,7 +208,7 @@ +@@ -209,7 +209,7 @@ "@com_google_protobuf//:LICENSE", "@curl//:COPYING", - "@dill_archive//:LICENSE", + "@ducc//:LICENSE", - "@flatbuffers//:LICENSE", + "@flatbuffers//:LICENSE.txt", - "@gast_archive//:PKG-INFO", "@gemmlowp//:LICENSE", "@libjpeg_turbo//:LICENSE.md", + "@llvm-project//llvm:LICENSE.TXT", diff --git a/pkgs/development/python-modules/tensorflow/protobuf_cc_toolchain.patch b/pkgs/development/python-modules/tensorflow/protobuf_cc_toolchain.patch new file mode 100644 index 00000000000000..1b63851f095a11 --- /dev/null +++ b/pkgs/development/python-modules/tensorflow/protobuf_cc_toolchain.patch @@ -0,0 +1,27 @@ +diff -Naurd x/third_party/systemlibs/protobuf.BUILD y/third_party/systemlibs/protobuf.BUILD +--- x/third_party/systemlibs/protobuf.BUILD 2023-12-03 15:39:27.742087246 +0000 ++++ y/third_party/systemlibs/protobuf.BUILD 2023-12-04 13:25:41.777638732 +0000 +@@ -1,4 +1,8 @@ +-load("@rules_proto//proto:defs.bzl", "proto_library") ++load( ++ "@rules_proto//proto:defs.bzl", ++ "proto_lang_toolchain", ++ "proto_library", ++) + load( + "@com_google_protobuf//:protobuf.bzl", + "cc_proto_library", +@@ -118,3 +122,13 @@ + srcs = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()], + visibility = ["//visibility:public"], + ) ++ ++proto_lang_toolchain( ++ name = "cc_toolchain", ++ blacklisted_protos = [ ++ "//:compiler_plugin_proto", ++ "//:descriptor_proto", ++ ], ++ command_line = "--cpp_out=$(OUT)", ++ visibility = ["//visibility:public"], ++) diff --git a/pkgs/development/python-modules/tensorflow/protobuf_lite.patch b/pkgs/development/python-modules/tensorflow/protobuf_lite.patch new file mode 100644 index 00000000000000..26d1d47ab30061 --- /dev/null +++ b/pkgs/development/python-modules/tensorflow/protobuf_lite.patch @@ -0,0 +1,16 @@ +diff -Naurd x/third_party/systemlibs/protobuf.BUILD y/third_party/systemlibs/protobuf.BUILD +--- x/third_party/systemlibs/protobuf.BUILD 2023-12-03 15:39:27.742087246 +0000 ++++ y/third_party/systemlibs/protobuf.BUILD 2023-12-03 20:23:49.345014695 +0000 +@@ -66,6 +66,12 @@ + ) + + cc_library( ++ name = "protobuf_lite", ++ linkopts = ["-lprotobuf-lite"], ++ visibility = ["//visibility:public"], ++) ++ ++cc_library( + name = "protobuf_headers", + linkopts = ["-lprotobuf"], + visibility = ["//visibility:public"], diff --git a/pkgs/development/python-modules/tensorflow/riegeli-proto.patch b/pkgs/development/python-modules/tensorflow/riegeli-proto.patch new file mode 100644 index 00000000000000..ef39e48ce22256 --- /dev/null +++ b/pkgs/development/python-modules/tensorflow/riegeli-proto.patch @@ -0,0 +1,36 @@ +diff -Naurd x/riegeli/records/BUILD y/riegeli/records/BUILD +--- x/riegeli/records/BUILD 2023-12-06 16:24:03.939575600 +0000 ++++ y/riegeli/records/BUILD 2023-12-06 16:23:00.079531687 +0000 +@@ -1,4 +1,4 @@ +-load("@rules_proto//proto:defs.bzl", "proto_library") ++load("@local_tsl//tsl/platform:build_config.bzl", "tf_proto_library") + + package( + default_visibility = ["//visibility:public"], +@@ -14,7 +14,7 @@ + deps = [ + ":chunk_reader", + ":record_position", +- ":records_metadata_cc_proto", ++ ":records_metadata_proto_cc_impl", + ":skipped_region", + "//riegeli/base:arithmetic", + "//riegeli/base:assert", +@@ -184,13 +184,10 @@ + ], + ) + +-proto_library( ++tf_proto_library( + name = "records_metadata_proto", + srcs = ["records_metadata.proto"], +- deps = ["@com_google_protobuf//:descriptor_proto"], +-) +- +-cc_proto_library( +- name = "records_metadata_cc_proto", +- deps = [":records_metadata_proto"], ++ cc_api_version = 2, ++ make_default_target_header_only = True, ++ visibility = ["//visibility:public"], + ) diff --git a/pkgs/development/python-modules/tensorflow/rules-python-newer-versions.patch b/pkgs/development/python-modules/tensorflow/rules-python-newer-versions.patch deleted file mode 100644 index c37317e0ef7ee8..00000000000000 --- a/pkgs/development/python-modules/tensorflow/rules-python-newer-versions.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff -Naurd python/pip_install/repositories.bzl python-newer-setuptools/pip_install/repositories.bzl ---- python/pip_install/repositories.bzl 2024-10-03 09:59:00.750017690 +0000 -+++ python-newer-versions/pip_install/repositories.bzl 2024-10-03 11:00:46.256594416 +0000 -@@ -52,8 +52,8 @@ - ), - ( - "pypi__pip", -- "https://files.pythonhosted.org/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl", -- "908c78e6bc29b676ede1c4d57981d490cb892eb45cd8c214ab6298125119e077", -+ "https://files.pythonhosted.org/packages/08/e3/57d4c24a050aa0bcca46b2920bff40847db79535dc78141eb83581a52eb8/pip-23.1.2-py3-none-any.whl", -+ "3ef6ac33239e4027d9a5598a381b9d30880a1477e50039db2eac6e8a8f6d1b18", - ), - ( - "pypi__pip_tools", -@@ -62,8 +62,8 @@ - ), - ( - "pypi__setuptools", -- "https://files.pythonhosted.org/packages/7c/5b/3d92b9f0f7ca1645cba48c080b54fe7d8b1033a4e5720091d1631c4266db/setuptools-60.10.0-py3-none-any.whl", -- "782ef48d58982ddb49920c11a0c5c9c0b02e7d7d1c2ad0aa44e1a1e133051c96", -+ "https://files.pythonhosted.org/packages/c5/94/00e3d21daa5a47c4f13d278ff08c1b3dbd167231e4a1c4b2c99e4616790e/setuptools-66.1.0-py3-none-any.whl", -+ "fc19f9f62120a763300fd78e234b3cbd3417be098f08c156eaaf36420627e57b", - ), - ( - "pypi__tomli", -diff -Naurd python/versions.bzl python-use-nix/versions.bzl ---- python/versions.bzl 2024-10-09 21:07:44.707544923 +0000 -+++ python-newer-versions/versions.bzl 2024-10-09 21:09:02.499715560 +0000 -@@ -243,6 +243,19 @@ - }, - "strip_prefix": "python", - }, -+ "3.12.0": { -+ "url": "20231002/cpython-{python_version}+20231002-{platform}-{build}.tar.gz", -+ "sha256": { -+ "aarch64-apple-darwin": "4734a2be2becb813830112c780c9879ac3aff111a0b0cd590e65ec7465774d02", -+ "aarch64-unknown-linux-gnu": "bccfe67cf5465a3dfb0336f053966e2613a9bc85a6588c2fcf1366ef930c4f88", -+ "ppc64le-unknown-linux-gnu": "b5dae075467ace32c594c7877fe6ebe0837681f814601d5d90ba4c0dfd87a1f2", -+ "s390x-unknown-linux-gnu": "5681621349dd85d9726d1b67c84a9686ce78f72e73a6f9e4cc4119911655759e", -+ "x86_64-apple-darwin": "5a9e88c8aa52b609d556777b52ebde464ae4b4f77e4aac4eb693af57395c9abf", -+ "x86_64-pc-windows-msvc": "facfaa1fbc8653f95057f3c4a0f8aa833dab0e0b316e24ee8686bc761d4b4f8d", -+ "x86_64-unknown-linux-gnu": "e51a5293f214053ddb4645b2c9f84542e2ef86870b8655704367bd4b29d39fe9", -+ }, -+ "strip_prefix": "python", -+ }, - } - - # buildifier: disable=unsorted-dict-items -@@ -251,6 +264,7 @@ - "3.9": "3.9.16", - "3.10": "3.10.9", - "3.11": "3.11.1", -+ "3.12": "3.12.0", - } - - PLATFORMS = { diff --git a/pkgs/development/python-modules/tensorflow/rules-python-use-nix.patch b/pkgs/development/python-modules/tensorflow/rules-python-use-nix.patch index 71105ad794ea25..c8ae7b3aba4b78 100644 --- a/pkgs/development/python-modules/tensorflow/rules-python-use-nix.patch +++ b/pkgs/development/python-modules/tensorflow/rules-python-use-nix.patch @@ -1,7 +1,7 @@ diff -Naurd python/private/toolchains_repo.bzl python-use-nix/private/toolchains_repo.bzl --- python/private/toolchains_repo.bzl 2024-10-07 06:42:33.209319301 +0000 +++ python-use-nix/private/toolchains_repo.bzl 2024-10-07 06:53:00.702389154 +0000 -@@ -181,14 +181,14 @@ +@@ -199,7 +199,7 @@ def py_binary(name, **kwargs): return _py_binary( name = name, @@ -10,6 +10,7 @@ diff -Naurd python/private/toolchains_repo.bzl python-use-nix/private/toolchains **kwargs ) +@@ -213,7 +213,7 @@ def py_test(name, **kwargs): return _py_test( name = name, @@ -21,7 +22,7 @@ diff -Naurd python/private/toolchains_repo.bzl python-use-nix/private/toolchains diff -Naurd python/repositories.bzl python-use-nix/repositories.bzl --- python/repositories.bzl 2023-11-29 23:07:55.169106050 +0000 +++ python-use-nix/repositories.bzl 2023-12-01 12:00:06.746231531 +0000 -@@ -103,60 +103,22 @@ +@@ -119,65 +119,23 @@ fail("Exactly one of (url, urls) must be set.") platform = rctx.attr.platform @@ -30,12 +31,14 @@ diff -Naurd python/repositories.bzl python-use-nix/repositories.bzl python_short_version = python_version.rpartition(".")[0] release_filename = rctx.attr.release_filename urls = rctx.attr.urls or [rctx.attr.url] + auth = _get_auth(rctx, urls) - if release_filename.endswith(".zst"): - rctx.download( - url = urls, - sha256 = rctx.attr.sha256, - output = release_filename, +- auth = auth, - ) - unzstd = rctx.which("unzstd") - if not unzstd: @@ -43,10 +46,12 @@ diff -Naurd python/repositories.bzl python-use-nix/repositories.bzl - rctx.download_and_extract( - url = url, - sha256 = rctx.attr.zstd_sha256, +- auth = auth, - ) - working_directory = "zstd-{version}".format(version = rctx.attr.zstd_version) +- - make_result = rctx.execute( -- ["make", "--jobs=4"], +- [which_with_fail("make", rctx), "--jobs=4"], - timeout = 600, - quiet = True, - working_directory = working_directory, @@ -62,7 +67,7 @@ diff -Naurd python/repositories.bzl python-use-nix/repositories.bzl - rctx.symlink(zstd, unzstd) - - exec_result = rctx.execute([ -- "tar", +- which_with_fail("tar", rctx), - "--extract", - "--strip-components=2", - "--use-compress-program={unzstd}".format(unzstd = unzstd), @@ -79,6 +84,7 @@ diff -Naurd python/repositories.bzl python-use-nix/repositories.bzl - url = urls, - sha256 = rctx.attr.sha256, - stripPrefix = rctx.attr.strip_prefix, +- auth = auth, + lndir_result = rctx.execute([ + "lndir", + "@python@", @@ -93,3 +99,17 @@ diff -Naurd python/repositories.bzl python-use-nix/repositories.bzl patches = rctx.attr.patches if patches: +diff -Naurd python/pip_install/pip_repository.bzl python-use-nix/pip_install/pip_repository.bzl +--- python/pip_install/pip_repository.bzl 2024-10-08 15:24:23.582898888 +0000 ++++ python-use-nix/pip_install/pip_repository.bzl 2024-10-08 16:33:38.733498958 +0000 +@@ -607,6 +607,10 @@ + # There is an extreme edge-case with entry_points that end with `.py` + # See: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/test/java/com/google/devtools/build/lib/rules/python/PyBinaryConfiguredTargetTest.java#L174 + entry_point_without_py = name[:-3] + "_py" if name.endswith(".py") else name ++ ++ if entry_point_without_py.startswith("f2py3"): ++ continue ++ + entry_point_target_name = ( + _WHEEL_ENTRY_POINT_PREFIX + "_" + entry_point_without_py + ) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b43806379b22ce..fd808c63809b9b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15330,35 +15330,6 @@ self: super: with self; { protobufTF = pkgs.protobuf_21.override { abseil-cpp = abseil-cppTF; }; - ml-dtypesTF = (self.ml-dtypes.overrideAttrs ( - oldAttrs: rec { - # recent versions deprecated float8_e4m3b11 - version = "0.1.0"; - name = "${oldAttrs.pname}-${version}"; - src = pkgs.fetchFromGitHub { - owner = "jax-ml"; - repo = "ml_dtypes"; - rev = "v${version}"; - hash = "sha256-3rs48WtXAfP5g15j8BDSd0ee+c6CPy+OTfUB3HLgPm8="; - fetchSubmodules = true; - }; - buildInputs = [ pybind11 ]; - dependencies = [ numpy ]; - postPatch = '' - substituteInPlace pyproject.toml \ - --replace-fail "numpy~=1.21.2" "numpy" \ - --replace-fail "numpy~=1.23.3" "numpy" \ - --replace-fail "pybind11~=2.10.0" "pybind11" \ - --replace-fail "setuptools~=67.6.0" "setuptools" - ''; - disabledTests = oldAttrs.disabledTests or [] - # these fail on Darwin: - # https://github.com/jax-ml/ml_dtypes/issues/47#issuecomment-1483821629 - ++ lib.optionals stdenv.isDarwin [ - "testBetweenCustomTypes_bfloat16" "testPredicateUfunc_bfloat16" - ]; - }) - ); # https://www.tensorflow.org/install/source#gpu cudaPackagesTF = pkgs.cudaPackages_11; grpcTF = (pkgs.grpc.overrideAttrs ( @@ -15426,7 +15397,6 @@ self: super: with self; { protobuf-python = compat.protobuf-pythonTF; grpc = compat.grpcTF; grpcio = compat.grpcioTF; - ml-dtypes = compat.ml-dtypesTF; tensorboard = compat.tensorboardTF; abseil-cpp = compat.abseil-cppTF; bazel_6 = compat.bazel_6_1_0;