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