From 0701680d0c8d5f8375123a16105e32359b829dcb Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 24 Nov 2021 14:29:28 -0500 Subject: [PATCH] python3Packages.tensorflow-bin: 2.4.0 -> 2.7.0 --- .../python-modules/tensorflow/bin.nix | 19 +++---- .../tensorflow/binary-hashes.nix | 46 ++++++++--------- .../python-modules/tensorflow/prefetcher.sh | 12 ++--- .../relax-dependencies-metadata.patch | 46 ----------------- .../tensorflow/relax-dependencies.patch | 51 ------------------- 5 files changed, 39 insertions(+), 135 deletions(-) delete mode 100644 pkgs/development/python-modules/tensorflow/relax-dependencies-metadata.patch delete mode 100644 pkgs/development/python-modules/tensorflow/relax-dependencies.patch diff --git a/pkgs/development/python-modules/tensorflow/bin.nix b/pkgs/development/python-modules/tensorflow/bin.nix index c14a90e0953e..c57147c8ff7f 100644 --- a/pkgs/development/python-modules/tensorflow/bin.nix +++ b/pkgs/development/python-modules/tensorflow/bin.nix @@ -42,15 +42,11 @@ assert ! (stdenv.isDarwin && cudaSupport); let packages = import ./binary-hashes.nix; - metadataPatch = ./relax-dependencies-metadata.patch; - patch = ./relax-dependencies.patch; in buildPythonPackage { pname = "tensorflow" + lib.optionalString cudaSupport "-gpu"; inherit (packages) version; format = "wheel"; - disabled = pythonAtLeast "3.9"; - src = let pyVerNoDot = lib.strings.stringAsChars (x: if x == "." then "" else x) python.pythonVersion; platform = if stdenv.isDarwin then "mac" else "linux"; @@ -93,13 +89,18 @@ in buildPythonPackage { pushd dist wheel unpack --dest unpacked ./*.whl + rm ./*.whl ( cd unpacked/tensorflow* - # relax too strict versions in setup.py - patch -p 1 < ${patch} - cd *.dist-info - # relax too strict versions in *.dist-info/METADATA - patch -p 3 < ${metadataPatch} + # Adjust dependency requirements: + # - Relax gast version requirement that doesn't match what we have packaged + # - The purpose of python3Packages.libclang is not clear at the moment and we don't have it packaged yet + # - keras and tensorlow-io-gcs-filesystem will be considered as optional for now. + sed -i *.dist-info/METADATA \ + -e "s/Requires-Dist: gast.*/Requires-Dist: gast/" \ + -e "/Requires-Dist: libclang/d" \ + -e "/Requires-Dist: keras/d" \ + -e "/Requires-Dist: tensorflow-io-gcs-filesystem/d" ) wheel pack ./unpacked/tensorflow* diff --git a/pkgs/development/python-modules/tensorflow/binary-hashes.nix b/pkgs/development/python-modules/tensorflow/binary-hashes.nix index 4485e2b61451..4b2f9d528407 100644 --- a/pkgs/development/python-modules/tensorflow/binary-hashes.nix +++ b/pkgs/development/python-modules/tensorflow/binary-hashes.nix @@ -1,39 +1,39 @@ { -version = "2.4.0"; -linux_py_36_cpu = { - url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.4.0-cp36-cp36m-manylinux2010_x86_64.whl"; - sha256 = "0pn0cjf50q0xsv6k0vihrz22kr392anznvdhxv80gk52c6lcgmsc"; -}; +version = "2.7.0"; linux_py_37_cpu = { - url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.4.0-cp37-cp37m-manylinux2010_x86_64.whl"; - sha256 = "0mdd83c0invqfy58qmpa3hk4yml5ic7wlwggyd5wpikadlv8vq89"; + url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.7.0-cp37-cp37m-manylinux2010_x86_64.whl"; + sha256 = "1irw4ri1fbxbj251cnjbr12gxsyj2k30asxjfxjpxhc9b0cchhx0"; }; linux_py_38_cpu = { - url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.4.0-cp38-cp38-manylinux2010_x86_64.whl"; - sha256 = "1mm1yz9aj3v6fxfpxh7wy37rvsncr0b5y6glqlcxmhr6mqfp8k6d"; + url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.7.0-cp38-cp38-manylinux2010_x86_64.whl"; + sha256 = "11a1rimr998lvvjdg03rqr8h2h7x6bbd4gyv74biwgaxmjczvjdj"; }; -linux_py_36_gpu = { - url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.4.0-cp36-cp36m-manylinux2010_x86_64.whl"; - sha256 = "113iygiq2kmj97g0glhcqng6rhl3rrj1iqw5xj1d5hla8xjy8cfv"; +linux_py_39_cpu = { + url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.7.0-cp39-cp39-manylinux2010_x86_64.whl"; + sha256 = "0x1zzmgq7hl2k98p8870h0yhaik39nc1ckvxirjx8simpj8ghsbp"; }; linux_py_37_gpu = { - url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.4.0-cp37-cp37m-manylinux2010_x86_64.whl"; - sha256 = "19ap8xx2j5nbmnqv5rzf1ryfvw2fbs6bm0fxjqrvhc3jxys6yqqs"; + url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.7.0-cp37-cp37m-manylinux2010_x86_64.whl"; + sha256 = "1x5yyxzkly9gdyhcfq4x7w7sqqxh6cw5qnfwbvzj5349xwrm63wi"; }; linux_py_38_gpu = { - url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.4.0-cp38-cp38-manylinux2010_x86_64.whl"; - sha256 = "0ly3cinzj6j3b547sw8bd3p774khn3b14cgrj7nvfrz668d3f89x"; + url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.7.0-cp38-cp38-manylinux2010_x86_64.whl"; + sha256 = "0prxa8yc6lbq62vnh8cw6dhcrnkdjih62kbg6pbw4gmgcbf6v6fg"; }; -mac_py_36_cpu = { - url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.4.0-cp36-cp36m-macosx_10_14_x86_64.whl"; - sha256 = "1b5ld1wj48l1i5s3vk8db5m578zdg4xfl0m1lc8w5lx1vi4cwsjp"; +linux_py_39_gpu = { + url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.7.0-cp39-cp39-manylinux2010_x86_64.whl"; + sha256 = "0jjv8vm20d0airml68bxhassp4yg09rcz2a39aa511cz8mavj0l6"; }; mac_py_37_cpu = { - url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.4.0-cp37-cp37m-macosx_10_14_x86_64.whl"; - sha256 = "1mgfyjgcwvx5jzawrpfnbch5sqw7kpnzp35rfxj22kwdsl28r47r"; + url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.7.0-cp37-cp37m-macosx_10_11_x86_64.whl"; + sha256 = "1gr95ck0h4wzhdacjfhkzxdw4zglm85fc54swqhyzzv1f5n9vw8j"; }; mac_py_38_cpu = { - url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.4.0-cp38-cp38-macosx_10_14_x86_64.whl"; - sha256 = "034qh0nk786wxzma58179g086x479c3pd9vi8v8p26grs6f2fm0p"; + url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.7.0-cp38-cp38-macosx_10_11_x86_64.whl"; + sha256 = "1h3qlvlrwyvxynh5flvyqk7grbvyqc21ljqhlvds436hpn2kqrgb"; +}; +mac_py_39_cpu = { + url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.7.0-cp39-cp39-macosx_10_11_x86_64.whl"; + sha256 = "0pyj1p2yik6ysdqn8n6cz1nqni0s9xx51ifmvdx4dl3hrzp86jz2"; }; } diff --git a/pkgs/development/python-modules/tensorflow/prefetcher.sh b/pkgs/development/python-modules/tensorflow/prefetcher.sh index 8b22affa17a8..bb189bb06d65 100755 --- a/pkgs/development/python-modules/tensorflow/prefetcher.sh +++ b/pkgs/development/python-modules/tensorflow/prefetcher.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -version="2.4.0" +version="2.7.0" bucket="https://storage.googleapis.com/tensorflow" @@ -8,15 +8,15 @@ bucket="https://storage.googleapis.com/tensorflow" # on the following page: # https://www.tensorflow.org/install/pip?lang=python3#package-location url_and_key_list=( -"linux_py_36_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp36-cp36m-manylinux2010_x86_64.whl" "linux_py_37_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp37-cp37m-manylinux2010_x86_64.whl" "linux_py_38_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp38-cp38-manylinux2010_x86_64.whl" -"linux_py_36_gpu $bucket/linux/gpu/tensorflow_gpu-${version}-cp36-cp36m-manylinux2010_x86_64.whl" +"linux_py_39_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp39-cp39-manylinux2010_x86_64.whl" "linux_py_37_gpu $bucket/linux/gpu/tensorflow_gpu-${version}-cp37-cp37m-manylinux2010_x86_64.whl" "linux_py_38_gpu $bucket/linux/gpu/tensorflow_gpu-${version}-cp38-cp38-manylinux2010_x86_64.whl" -"mac_py_36_cpu $bucket/mac/cpu/tensorflow-${version}-cp36-cp36m-macosx_10_14_x86_64.whl" -"mac_py_37_cpu $bucket/mac/cpu/tensorflow-${version}-cp37-cp37m-macosx_10_14_x86_64.whl" -"mac_py_38_cpu $bucket/mac/cpu/tensorflow-${version}-cp38-cp38-macosx_10_14_x86_64.whl" +"linux_py_39_gpu $bucket/linux/gpu/tensorflow_gpu-${version}-cp39-cp39-manylinux2010_x86_64.whl" +"mac_py_37_cpu $bucket/mac/cpu/tensorflow-${version}-cp37-cp37m-macosx_10_11_x86_64.whl" +"mac_py_38_cpu $bucket/mac/cpu/tensorflow-${version}-cp38-cp38-macosx_10_11_x86_64.whl" +"mac_py_39_cpu $bucket/mac/cpu/tensorflow-${version}-cp39-cp39-macosx_10_11_x86_64.whl" ) hashfile=binary-hashes.nix diff --git a/pkgs/development/python-modules/tensorflow/relax-dependencies-metadata.patch b/pkgs/development/python-modules/tensorflow/relax-dependencies-metadata.patch deleted file mode 100644 index 1be4fd5bc7d5..000000000000 --- a/pkgs/development/python-modules/tensorflow/relax-dependencies-metadata.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -ur unpacked/tensorflow-2.4.0/tensorflow-2.4.0.dist-info/METADATA unpacked.new/tensorflow-2.4.0/tensorflow-2.4.0.dist-info/METADATA ---- unpacked/tensorflow-2.4.0/tensorflow-2.4.0.dist-info/METADATA 2021-05-06 23:51:40.298995191 -0700 -+++ unpacked.new/tensorflow-2.4.0/tensorflow-2.4.0.dist-info/METADATA 2021-05-07 00:03:49.856882153 -0700 -@@ -27,24 +27,24 @@ - Classifier: Topic :: Software Development :: Libraries - Classifier: Topic :: Software Development :: Libraries :: Python Modules - Description-Content-Type: text/markdown --Requires-Dist: absl-py (~=0.10) --Requires-Dist: astunparse (~=1.6.3) --Requires-Dist: flatbuffers (~=1.12.0) --Requires-Dist: google-pasta (~=0.2) --Requires-Dist: h5py (~=2.10.0) --Requires-Dist: keras-preprocessing (~=1.1.2) --Requires-Dist: numpy (~=1.19.2) --Requires-Dist: opt-einsum (~=3.3.0) --Requires-Dist: protobuf (>=3.9.2) --Requires-Dist: six (~=1.15.0) --Requires-Dist: termcolor (~=1.1.0) --Requires-Dist: typing-extensions (~=3.7.4) --Requires-Dist: wheel (~=0.35) --Requires-Dist: wrapt (~=1.12.1) --Requires-Dist: gast (==0.3.3) --Requires-Dist: tensorboard (~=2.4) --Requires-Dist: tensorflow-estimator (<2.5.0,>=2.4.0rc0) --Requires-Dist: grpcio (~=1.32.0) -+Requires-Dist: absl-py -+Requires-Dist: astunparse -+Requires-Dist: flatbuffers -+Requires-Dist: google-pasta -+Requires-Dist: h5py -+Requires-Dist: keras-preprocessing -+Requires-Dist: numpy -+Requires-Dist: opt-einsum -+Requires-Dist: protobuf -+Requires-Dist: six -+Requires-Dist: termcolor -+Requires-Dist: typing-extensions -+Requires-Dist: wheel -+Requires-Dist: wrapt -+Requires-Dist: gast -+Requires-Dist: tensorboard -+Requires-Dist: tensorflow-estimator -+Requires-Dist: grpcio - - [![Python](https://img.shields.io/pypi/pyversions/tensorflow.svg?style=plastic)](https://badge.fury.io/py/tensorflow) - [![PyPI](https://badge.fury.io/py/tensorflow.svg)](https://badge.fury.io/py/tensorflow) \ No newline at end of file diff --git a/pkgs/development/python-modules/tensorflow/relax-dependencies.patch b/pkgs/development/python-modules/tensorflow/relax-dependencies.patch deleted file mode 100644 index b26c1e95a645..000000000000 --- a/pkgs/development/python-modules/tensorflow/relax-dependencies.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py -index 65133afdafe..8ef6364ff7e 100644 ---- a/tensorflow/tools/pip_package/setup.py -+++ b/tensorflow/tools/pip_package/setup.py -@@ -75,23 +75,23 @@ if '--project_name' in sys.argv: - # comment the versioning scheme. - # NOTE: Please add test only packages to `TEST_PACKAGES` below. - REQUIRED_PACKAGES = [ -- 'absl-py ~= 0.10', -- 'astunparse ~= 1.6.3', -- 'flatbuffers ~= 1.12.0', -- 'google_pasta ~= 0.2', -- 'h5py ~= 2.10.0', -- 'keras_preprocessing ~= 1.1.2', -- 'numpy ~= 1.19.2', -- 'opt_einsum ~= 3.3.0', -+ 'absl-py >= 0.10', -+ 'astunparse >= 1.6.3', -+ 'flatbuffers >= 1.12.0', -+ 'google_pasta >= 0.2', -+ 'h5py >= 2.10.0', -+ 'keras_preprocessing >= 1.1.2', -+ 'numpy >= 1.19.1', -+ 'opt_einsum >= 3.3.0', - 'protobuf >= 3.9.2', -- 'six ~= 1.15.0', -- 'termcolor ~= 1.1.0', -- 'typing_extensions ~= 3.7.4', -- 'wheel ~= 0.35', -- 'wrapt ~= 1.12.1', -+ 'six >= 1.15.0', -+ 'termcolor >= 1.1.0', -+ 'typing_extensions >= 3.7.4', -+ 'wheel >= 0.34.2', -+ 'wrapt >= 1.12.1', - # These packages needs to be pinned exactly as newer versions are - # incompatible with the rest of the ecosystem -- 'gast == 0.3.3', -+ 'gast >= 0.3.3', - # TensorFlow ecosystem packages that TF exposes API for - # These need to be in sync with the existing TF version - # They are updated during the release process -@@ -118,7 +118,7 @@ if 'tf_nightly' in project_name: - # BoringSSL support. - # See https://github.com/tensorflow/tensorflow/issues/17882. - if sys.byteorder == 'little': -- REQUIRED_PACKAGES.append('grpcio ~= 1.32.0') -+ REQUIRED_PACKAGES.append('grpcio >= 1.31.0') - - - # Packages which are only needed for testing code.