python.pkgs.tensorflow: cleanup binary build
This commit is contained in:
parent
2e46ae0daa
commit
170dd558df
3 changed files with 19 additions and 12 deletions
|
@ -35,15 +35,19 @@
|
|||
assert cudaSupport -> cudatoolkit != null
|
||||
&& cudnn != null
|
||||
&& nvidia_x11 != null;
|
||||
|
||||
# unsupported combination
|
||||
assert ! (stdenv.isDarwin && cudaSupport);
|
||||
|
||||
let
|
||||
cudatoolkit_joined = symlinkJoin {
|
||||
name = "unsplit_cudatoolkit";
|
||||
paths = [ cudatoolkit.out
|
||||
cudatoolkit.lib ];};
|
||||
packages = import ./binary-hashes.nix;
|
||||
|
||||
variant = if cudaSupport then "-gpu" else "";
|
||||
pname = "tensorflow${variant}";
|
||||
|
||||
in buildPythonPackage rec {
|
||||
pname = "tensorflow";
|
||||
version = "1.14.0";
|
||||
inherit pname;
|
||||
inherit (packages) version;
|
||||
format = "wheel";
|
||||
|
||||
src = let
|
||||
|
@ -52,8 +56,7 @@ in buildPythonPackage rec {
|
|||
platform = if stdenv.isDarwin then "mac" else "linux";
|
||||
unit = if cudaSupport then "gpu" else "cpu";
|
||||
key = "${platform}_py_${pyver}_${unit}";
|
||||
dls = import (./. + "/tf${version}-hashes.nix");
|
||||
in fetchurl dls.${key};
|
||||
in fetchurl packages.${key};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
protobuf
|
||||
|
@ -86,9 +89,9 @@ in buildPythonPackage rec {
|
|||
# patchelf --shrink-rpath will remove the cuda libraries.
|
||||
postFixup = let
|
||||
rpath = stdenv.lib.makeLibraryPath
|
||||
([ stdenv.cc.cc.lib zlib ] ++ lib.optionals cudaSupport [ cudatoolkit_joined cudnn nvidia_x11 ]);
|
||||
([ stdenv.cc.cc.lib zlib ] ++ lib.optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn nvidia_x11 ]);
|
||||
in
|
||||
lib.optionalString (stdenv.isLinux) ''
|
||||
lib.optionalString stdenv.isLinux ''
|
||||
rrPath="$out/${python.sitePackages}/tensorflow/:$out/${python.sitePackages}/tensorflow/contrib/tensor_forest/:${rpath}"
|
||||
internalLibPath="$out/${python.sitePackages}/tensorflow/python/_pywrap_tensorflow_internal.so"
|
||||
find $out \( -name '*.so' -or -name '*.so.*' \) -exec patchelf --set-rpath "$rrPath" {} \;
|
||||
|
@ -100,7 +103,7 @@ in buildPythonPackage rec {
|
|||
homepage = http://tensorflow.org;
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ jyp abbradar ];
|
||||
platforms = with platforms; linux ++ lib.optionals (!cudaSupport) darwin;
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
||||
# Python 2.7 build uses different string encoding.
|
||||
# See https://github.com/NixOS/nixpkgs/pull/37044#issuecomment-373452253
|
||||
broken = stdenv.isDarwin && !isPy3k;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
version = "1.14.0";
|
||||
linux_py_27_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp27-none-linux_x86_64.whl";
|
||||
sha256 = "0yywdrfk97dh1bxhibspg0raz70fx9lcczj6xlimqy4xb60clx7k";
|
5
pkgs/development/python-modules/tensorflow/prefetcher.sh
Normal file → Executable file
5
pkgs/development/python-modules/tensorflow/prefetcher.sh
Normal file → Executable file
|
@ -1,7 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
version=1.14.0
|
||||
hashfile=tf${version}-hashes.nix
|
||||
hashfile=binary-hashes.nix
|
||||
rm -f $hashfile
|
||||
echo "{" >> $hashfile
|
||||
echo "version = \"$version\";" >> $hashfile
|
||||
for sys in "linux" "mac"; do
|
||||
for tfpref in "cpu/tensorflow" "gpu/tensorflow_gpu"; do
|
||||
for pykind in "py2-none-any" "py3-none-any" "cp27-none-linux_x86_64" "cp35-cp35m-linux_x86_64" "cp36-cp36m-linux_x86_64" "cp37-cp37m-linux_x86_64"; do
|
||||
|
|
Loading…
Reference in a new issue