From 9a1edca21486bcc686c2216c55fad318c3eaff26 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 25 Sep 2022 13:19:04 +0200 Subject: [PATCH] libtensorflow-bin: drop The package was introduced when our source package did not expose libtensorflow, which it does these days. Additionally the -bin package has not been well maintained and is stuck on a version from 2020/12. --- .../configuration-tensorflow.nix | 5 +- .../libraries/science/math/tensorflow/bin.nix | 75 ------------------- .../science/math/tensorflow/binary-hashes.nix | 15 ---- .../science/math/tensorflow/prefetcher.sh | 26 ------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 10 +-- 6 files changed, 3 insertions(+), 129 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/tensorflow/bin.nix delete mode 100644 pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix delete mode 100755 pkgs/development/libraries/science/math/tensorflow/prefetcher.sh diff --git a/pkgs/development/haskell-modules/configuration-tensorflow.nix b/pkgs/development/haskell-modules/configuration-tensorflow.nix index 31c679f9b842..54a5bc52ebaa 100644 --- a/pkgs/development/haskell-modules/configuration-tensorflow.nix +++ b/pkgs/development/haskell-modules/configuration-tensorflow.nix @@ -23,10 +23,7 @@ in { tensorflow-proto = doJailbreak (setTensorflowSourceRoot "tensorflow-proto" super.tensorflow-proto); - tensorflow = (setTensorflowSourceRoot "tensorflow" super.tensorflow).override { - # the "regular" Python package does not seem to include the binary library - libtensorflow = pkgs.libtensorflow-bin; - }; + tensorflow = setTensorflowSourceRoot "tensorflow" super.tensorflow; tensorflow-core-ops = setTensorflowSourceRoot "tensorflow-core-ops" super.tensorflow-core-ops; diff --git a/pkgs/development/libraries/science/math/tensorflow/bin.nix b/pkgs/development/libraries/science/math/tensorflow/bin.nix deleted file mode 100644 index 1b769f44eeb1..000000000000 --- a/pkgs/development/libraries/science/math/tensorflow/bin.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ lib, stdenv -, fetchurl -, addOpenGLRunpath -, cudaSupport ? false, cudaPackages ? {} -, symlinkJoin -}: - -with lib; -let - broken = !stdenv.isLinux && !stdenv.isDarwin; - - inherit (cudaPackages) cudatoolkit cudnn; - - tfType = if cudaSupport then "gpu" else "cpu"; - - system = - if stdenv.isLinux then "linux" - else "darwin"; - - platform = "x86_64"; - - rpath = makeLibraryPath ([stdenv.cc.libc stdenv.cc.cc.lib] - ++ optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn ]); - - packages = import ./binary-hashes.nix; - - patchLibs = - if stdenv.isDarwin - then '' - install_name_tool -id $out/lib/libtensorflow.dylib $out/lib/libtensorflow.dylib - install_name_tool -id $out/lib/libtensorflow_framework.dylib $out/lib/libtensorflow_framework.dylib - '' - else '' - patchelf --set-rpath "${rpath}:$out/lib" $out/lib/libtensorflow.so - patchelf --set-rpath "${rpath}" $out/lib/libtensorflow_framework.so - ${optionalString cudaSupport '' - addOpenGLRunpath $out/lib/libtensorflow.so $out/lib/libtensorflow_framework.so - ''} - ''; - -in stdenv.mkDerivation rec { - pname = "libtensorflow"; - inherit (packages) version; - - src = fetchurl packages."${tfType}-${system}-${platform}"; - - nativeBuildInputs = optional cudaSupport addOpenGLRunpath; - - # Patch library to use our libc, libstdc++ and others - buildCommand = '' - mkdir -pv $out - tar -C $out -xzf $src - chmod -R +w $out - ${patchLibs} - - # Write pkg-config file. - mkdir $out/lib/pkgconfig - cat > $out/lib/pkgconfig/tensorflow.pc << EOF - Name: TensorFlow - Version: ${version} - Description: Library for computation using data flow graphs for scalable machine learning - Requires: - Libs: -L$out/lib -ltensorflow - Cflags: -I$out/include/tensorflow - EOF - ''; - - meta = { - description = "C API for TensorFlow"; - homepage = "https://www.tensorflow.org/install/lang_c"; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = licenses.asl20; - platforms = [ "x86_64-linux" "x86_64-darwin" ]; - }; -} diff --git a/pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix b/pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix deleted file mode 100644 index b606e45477a9..000000000000 --- a/pkgs/development/libraries/science/math/tensorflow/binary-hashes.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ -version = "2.4.0"; -"cpu-linux-x86_64" = { - url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.4.0.tar.gz"; - sha256 = "022p5jjwmb8rhyyis3cpk2lw45apl2vz49m2rgxmd75h783x1gjk"; -}; -"gpu-linux-x86_64" = { - url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.4.0.tar.gz"; - sha256 = "1fclvbrn3fs8qmhmh3lzni7s7wl1w30a071b4gzh9ifnxdhip6lq"; -}; -"cpu-darwin-x86_64" = { - url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.4.0.tar.gz"; - sha256 = "09x096nslg04c8sr7bd5v68a5gfinc0f1h36lbzn8bahs8b1agi3"; -}; -} diff --git a/pkgs/development/libraries/science/math/tensorflow/prefetcher.sh b/pkgs/development/libraries/science/math/tensorflow/prefetcher.sh deleted file mode 100755 index d571d38f7719..000000000000 --- a/pkgs/development/libraries/science/math/tensorflow/prefetcher.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# ./prefetcher.sh 2.4.0 binary-hashes.nix - -version="$1" -hashfile="$2" -rm -f $hashfile -echo "{" >> $hashfile -echo "version = \"$version\";" >> $hashfile -for sys in "linux" "darwin"; do - for tfpref in "cpu" "gpu"; do - for platform in "x86_64"; do - if [ $sys = "darwin" ] && [ $tfpref = "gpu" ]; then - continue - fi - url=https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-$tfpref-$sys-$platform-$version.tar.gz - hash=$(nix-prefetch-url $url) - echo "\"${tfpref}-${sys}-${platform}\" = {" >> $hashfile - echo " url = \"$url\";" >> $hashfile - echo " sha256 = \"$hash\";" >> $hashfile - echo "};" >> $hashfile - done - done -done -echo "}" >> $hashfile - diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index e466bba8e172..2b9d3fd202d1 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -612,6 +612,7 @@ mapAliases ({ libseat = throw "'libseat' has been renamed to/replaced by 'seatd'"; # Converted to throw 2022-09-24 libspotify = throw "libspotify has been removed because Spotify stopped supporting it"; # added 2022-05-29 libsysfs = throw "'libsysfs' has been renamed to/replaced by 'sysfsutils'"; # Converted to throw 2022-02-22 + libtensorflow-bin = libtensorflow; # Added 2022-09-25 libtidy = throw "'libtidy' has been renamed to/replaced by 'html-tidy'"; # Converted to throw 2022-02-22 libtorrentRasterbar = throw "'libtorrentRasterbar' has been renamed to/replaced by 'libtorrent-rasterbar'"; # Converted to throw 2022-09-24 libtorrentRasterbar-1_1_x = throw "'libtorrentRasterbar-1_1_x' has been renamed to/replaced by 'libtorrent-rasterbar-1_1_x'"; # Converted to throw 2022-09-24 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 979735e37135..a47449477019 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3046,15 +3046,7 @@ with pkgs; tensor = libsForQt5.callPackage ../applications/networking/instant-messengers/tensor { }; - libtensorflow-bin = callPackage ../development/libraries/science/math/tensorflow/bin.nix { - cudaSupport = config.cudaSupport or false; - cudaPackages = cudaPackages_10_0; - }; - - libtensorflow = - if python3.pkgs.tensorflow ? libtensorflow - then python3.pkgs.tensorflow.libtensorflow - else libtensorflow-bin; + libtensorflow = python3.pkgs.tensorflow.libtensorflow; libtorch-bin = callPackage ../development/libraries/science/math/libtorch/bin.nix { cudaSupport = config.cudaSupport or false;