Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 58a4c2dbffdf
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 35ac8ba49252
Choose a head ref
  • 6 commits
  • 23 files changed
  • 5 contributors

Commits on Mar 28, 2020

  1. python3Packages.tensorflow-estimator: 1.15.1 -> 2.1.0

    (cherry picked from commit c186f5e)
    cdepillabout authored and Ericson2314 committed Mar 28, 2020
    Copy the full SHA
    9939bd6 View commit details
  2. pythonPackages.tensorflow-estimator_1_15_1: init at 1.15.1

    TF 1.15 still needs an older version of the tensorflow-estimator
    package.
    
    (cherry picked from commit c539f93)
    andir authored and Ericson2314 committed Mar 28, 2020
    Copy the full SHA
    6c7b2ac View commit details

Commits on Mar 30, 2020

  1. bazel_0_29: init at 0.29.1

    Needed for Tensorflow 2.1
    Ericson2314 committed Mar 30, 2020
    Copy the full SHA
    d4de62d View commit details
  2. python.pkgs.tensorflow{,-bin,-estimator,-tensorboard}-2: Init at 2.1.0

    Major breaking change from 1.x, so treating keeping both versions for now.
    
    (adapted from 33f11be)
    (adapted from 9e8dea7)
    timokau authored and Ericson2314 committed Mar 30, 2020
    Copy the full SHA
    a730888 View commit details
  3. Copy the full SHA
    1fa3105 View commit details
  4. Merge pull request #83518 from obsidiansystems/add-tensorflow-2

    python.pkgs.{tensorflow,tensorflow-estimator,tensorflow-tensorboard}-2: Init at 2.0.0
    Ericson2314 authored Mar 30, 2020
    Copy the full SHA
    35ac8ba View commit details
Showing with 1,898 additions and 20 deletions.
  1. 0 pkgs/development/python-modules/tensorflow-estimator/{1_15_1.nix → 1/default.nix}
  2. 0 pkgs/development/python-modules/tensorflow-estimator/{ → 2}/default.nix
  3. +1 −1 pkgs/development/python-modules/tensorflow-probability/default.nix
  4. +66 −0 pkgs/development/python-modules/tensorflow-tensorboard/1/default.nix
  5. 0 pkgs/development/python-modules/tensorflow-tensorboard/{ → 2}/default.nix
  6. +121 −0 pkgs/development/python-modules/tensorflow/1/bin.nix
  7. +43 −0 pkgs/development/python-modules/tensorflow/1/binary-hashes.nix
  8. +9 −10 pkgs/development/python-modules/tensorflow/{ → 1}/default.nix
  9. 0 pkgs/development/python-modules/tensorflow/{ → 1}/lift-gast-restriction.patch
  10. +33 −0 pkgs/development/python-modules/tensorflow/1/prefetcher.sh
  11. +2 −2 pkgs/development/python-modules/tensorflow/{ → 2}/bin.nix
  12. 0 pkgs/development/python-modules/tensorflow/{ → 2}/binary-hashes.nix
  13. +421 −0 pkgs/development/python-modules/tensorflow/2/default.nix
  14. +11 −0 pkgs/development/python-modules/tensorflow/2/lift-gast-restriction.patch
  15. 0 pkgs/development/python-modules/tensorflow/{ → 2}/prefetcher.sh
  16. 0 pkgs/development/tools/build-managers/bazel/{bazel_0 → bazel_0_26}/default.nix
  17. 0 pkgs/development/tools/build-managers/bazel/{bazel_0 → bazel_0_26}/glibc.patch
  18. 0 pkgs/development/tools/build-managers/bazel/{bazel_0 → bazel_0_26}/python-stub-path-fix.patch
  19. +559 −0 pkgs/development/tools/build-managers/bazel/bazel_0_29/default.nix
  20. +78 −0 pkgs/development/tools/build-managers/bazel/bazel_0_29/glibc.patch
  21. +506 −0 pkgs/development/tools/build-managers/bazel/bazel_0_29/src-deps.json
  22. +12 −1 pkgs/top-level/all-packages.nix
  23. +36 −6 pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ let
bazelTarget = ":pip_pkg";

fetchAttrs = {
sha256 = "0135nxxvkmjzpd80r1g9fdkk9h62g0xlvp32g5zgk0hkma5kq0bx";
sha256 = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
};

buildAttrs = {
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{ lib, fetchPypi, buildPythonPackage, isPy3k
, numpy
, wheel
, werkzeug
, protobuf
, grpcio
, markdown
, futures
, absl-py
}:

# tensorflow/tensorboard is built from a downloaded wheel, because
# https://github.com/tensorflow/tensorboard/issues/719 blocks
# buildBazelPackage.

buildPythonPackage rec {
pname = "tensorflow-tensorboard";
version = "1.15.0";
format = "wheel";

src = fetchPypi ({
pname = "tensorboard";
inherit version;
format = "wheel";
} // (if isPy3k then {
python = "py3";
sha256 = "1g62i3nrgp8q9wfsyqqjkkfnsz7x2k018c26kdh527h1yrjjrbac";
} else {
python = "py2";
sha256 = "0l3zc8j2sh7h1z4qpy8kfvclv3kzndri55p10i42q6xahs9phav1";
}));

propagatedBuildInputs = [
numpy
werkzeug
protobuf
markdown
grpcio
absl-py
# not declared in install_requires, but used at runtime
# https://github.com/NixOS/nixpkgs/issues/73840
wheel
] ++ lib.optional (!isPy3k) futures;

# in the absence of a real test suite, run cli and imports
checkPhase = ''
$out/bin/tensorboard --help > /dev/null
'';

pythonImportsCheck = [
"tensorboard"
"tensorboard.backend"
"tensorboard.compat"
"tensorboard.data"
"tensorboard.plugins"
"tensorboard.summary"
"tensorboard.util"
];

meta = with lib; {
description = "TensorFlow's Visualization Toolkit";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ abbradar ];
};
}
121 changes: 121 additions & 0 deletions pkgs/development/python-modules/tensorflow/1/bin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{ stdenv
, lib
, fetchurl
, buildPythonPackage
, isPy3k, pythonOlder, isPy38
, astor
, gast
, google-pasta
, wrapt
, numpy
, six
, termcolor
, protobuf
, absl-py
, grpcio
, mock
, backports_weakref
, tensorflow-estimator_1
, tensorflow-tensorboard
, cudaSupport ? false
, cudatoolkit ? null
, cudnn ? null
, nvidia_x11 ? null
, zlib
, python
, symlinkJoin
, keras-applications
, keras-preprocessing
, addOpenGLRunpath
}:

# We keep this binary build for two reasons:
# - the source build doesn't work on Darwin.
# - the source build is currently brittle and not easy to maintain

assert cudaSupport -> cudatoolkit != null
&& cudnn != null
&& nvidia_x11 != null;

# unsupported combination
assert ! (stdenv.isDarwin && cudaSupport);

let
packages = import ./binary-hashes.nix;

variant = if cudaSupport then "-gpu" else "";
pname = "tensorflow${variant}";

in buildPythonPackage {
inherit pname;
inherit (packages) version;
format = "wheel";

disabled = isPy38;

src = let
pyVerNoDot = lib.strings.stringAsChars (x: if x == "." then "" else x) python.pythonVersion;
pyver = if stdenv.isDarwin then builtins.substring 0 1 pyVerNoDot else pyVerNoDot;
platform = if stdenv.isDarwin then "mac" else "linux";
unit = if cudaSupport then "gpu" else "cpu";
key = "${platform}_py_${pyver}_${unit}";
in fetchurl packages.${key};

propagatedBuildInputs = [
protobuf
numpy
termcolor
grpcio
six
astor
absl-py
gast
google-pasta
wrapt
tensorflow-estimator_1
tensorflow-tensorboard
keras-applications
keras-preprocessing
] ++ lib.optional (!isPy3k) mock
++ lib.optionals (pythonOlder "3.4") [ backports_weakref ];

nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath;

# Upstream has a pip hack that results in bin/tensorboard being in both tensorflow
# and the propageted input tensorflow-tensorboard which causes environment collisions.
# another possibility would be to have tensorboard only in the buildInputs
# https://github.com/tensorflow/tensorflow/blob/v1.7.1/tensorflow/tools/pip_package/setup.py#L79
postInstall = ''
rm $out/bin/tensorboard
'';

# Note that we need to run *after* the fixup phase because the
# libraries are loaded at runtime. If we run in preFixup then
# patchelf --shrink-rpath will remove the cuda libraries.
postFixup = let
rpath = stdenv.lib.makeLibraryPath
([ stdenv.cc.cc.lib zlib ] ++ lib.optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn nvidia_x11 ]);
in
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 -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
patchelf --set-rpath "$rrPath" "$lib"
${lib.optionalString cudaSupport ''
addOpenGLRunpath "$lib"
''}
done
'';


meta = with stdenv.lib; {
description = "Computation using data flow graphs for scalable machine learning";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ jyp abbradar ];
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;
};
}
43 changes: 43 additions & 0 deletions pkgs/development/python-modules/tensorflow/1/binary-hashes.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
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";
};
linux_py_35_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp35-cp35m-linux_x86_64.whl";
sha256 = "1xvyb6xcrjhlwvrmrhn5vs9xy7g98smqmpv4i3hhpry4qyasphhj";
};
linux_py_36_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp36-cp36m-linux_x86_64.whl";
sha256 = "1psd9vyxz9f39dwj77nvrg373sxv3p5vdp9fnz81dpsm0b0mwl44";
};
linux_py_37_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp37-cp37m-linux_x86_64.whl";
sha256 = "0bg2sb1n2ag27r7ww695kg5hb0mjrw4kc5893krmixx2j71860c5";
};
linux_py_27_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp27-none-linux_x86_64.whl";
sha256 = "0y1x91gayg6pjddgl8ndcm63wfzhyv4s5khgl7ffzsgni1ivaqw5";
};
linux_py_35_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp35-cp35m-linux_x86_64.whl";
sha256 = "03piggpbz1jx8m2b95spq3jrdff4w6xx63ji07am7hyw2nsgx3mx";
};
linux_py_36_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp36-cp36m-linux_x86_64.whl";
sha256 = "0ypkp8cfhharsyyikb1qgf44cfm6284km9xswzvzymjzz75vg3gd";
};
linux_py_37_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp37-cp37m-linux_x86_64.whl";
sha256 = "0virp8nn2ysx4855hq29kas6fm6b3dsiybwzdxy9nnb9n2d8qlm2";
};
mac_py_2_cpu = {
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py2-none-any.whl";
sha256 = "14f86k3pgq7z6i4s4im55zpp38f0drnm7xlclavsgcc0nxnj3z26";
};
mac_py_3_cpu = {
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py3-none-any.whl";
sha256 = "0f3swpcjfgqhj6h5wnx8snc0xjkx4hnkqx83fmlrwpncs8c131d3";
};
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{ stdenv, pkgs, bazel_0, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
{ stdenv, pkgs, bazel_0_26, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
, addOpenGLRunpath
# Python deps
, buildPythonPackage, isPy3k, isPy27, pythonOlder, pythonAtLeast, python
# Python libraries
, numpy, tensorflow-tensorboard, backports_weakref, mock, enum34, absl-py
, numpy, tensorflow-tensorboard_1, backports_weakref, mock, enum34, absl-py
, future, setuptools, wheel, keras-preprocessing, keras-applications, google-pasta
, functools32
, opt-einsum
, termcolor, grpcio, six, wrapt, protobuf, tensorflow-estimator_1_15_1
, termcolor, grpcio, six, wrapt, protobuf, tensorflow-estimator_1
# Common deps
, git, swig, which, binutils, glibcLocales, cython
# Common libraries
@@ -94,7 +94,7 @@ let

bazel-build = buildBazelPackage {
name = "${pname}-${version}";
bazel = bazel_0;
bazel = bazel_0_26;

src = fetchFromGitHub {
owner = "tensorflow";
@@ -105,9 +105,9 @@ let

patches = [
# Work around https://github.com/tensorflow/tensorflow/issues/24752
./no-saved-proto.patch
../no-saved-proto.patch
# Fixes for NixOS jsoncpp
./system-jsoncpp.patch
../system-jsoncpp.patch

# https://github.com/tensorflow/tensorflow/pull/29673
(fetchpatch {
@@ -121,7 +121,6 @@ let
sha256 = "1n9ypbrx36fc1kc9cz5b3p9qhg15xxhq4nz6ap3hwqba535nakfz";
})


(fetchpatch {
# be compatible with gast >0.2 instead of only gast 0.2.2
name = "gast-update.patch";
@@ -132,7 +131,7 @@ let

# cuda 10.2 does not have "-bin2c-path" option anymore
# https://github.com/tensorflow/tensorflow/issues/34429
./cuda-10.2-no-bin2c-path.patch
../cuda-10.2-no-bin2c-path.patch
];

# On update, it can be useful to steal the changes from gentoo
@@ -373,7 +372,7 @@ in buildPythonPackage {
numpy
six
protobuf
tensorflow-estimator_1_15_1
tensorflow-estimator_1
termcolor
wrapt
grpcio
@@ -385,7 +384,7 @@ in buildPythonPackage {
] ++ lib.optionals (pythonOlder "3.4") [
backports_weakref enum34
] ++ lib.optionals withTensorboard [
tensorflow-tensorboard
tensorflow-tensorboard_1
];

nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath;
33 changes: 33 additions & 0 deletions pkgs/development/python-modules/tensorflow/1/prefetcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

version=1.14.0
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
if [ $sys == "mac" ]; then
[[ $pykind =~ py.* ]] && [[ $tfpref =~ cpu.* ]]
result=$?
pyver=${pykind:2:1}
flavour=cpu
else
[[ $pykind =~ .*linux.* ]]
result=$?
pyver=${pykind:2:2}
flavour=${tfpref:0:3}
fi
if [ $result == 0 ]; then
url=https://storage.googleapis.com/tensorflow/$sys/$tfpref-$version-$pykind.whl
hash=$(nix-prefetch-url $url)
echo "${sys}_py_${pyver}_${flavour} = {" >> $hashfile
echo " url = \"$url\";" >> $hashfile
echo " sha256 = \"$hash\";" >> $hashfile
echo "};" >> $hashfile
fi
done
done
done
echo "}" >> $hashfile
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
, wheel
, opt-einsum
, backports_weakref
, tensorflow-estimator
, tensorflow-estimator_2
, tensorflow-tensorboard
, cudaSupport ? false
, cudatoolkit ? null
@@ -76,7 +76,7 @@ in buildPythonPackage {
opt-einsum
google-pasta
wrapt
tensorflow-estimator
tensorflow-estimator_2
tensorflow-tensorboard
keras-applications
keras-preprocessing
Loading