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: 08bd71704950
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2ca3f24f21f2
Choose a head ref
  • 8 commits
  • 22 files changed
  • 4 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
    cef0110 View commit details
  4. Copy the full SHA
    6ca72b6 View commit details
  5. tensorflow_2: Mark as broken for now

    The other bits are good and worth keeping, however.
    Ericson2314 committed Mar 30, 2020
    Copy the full SHA
    f2c8b07 View commit details
  6. Copy the full SHA
    2ca3f24 View commit details
Showing with 2,010 additions and 20 deletions.
  1. +4 −2 pkgs/development/python-modules/tensorflow-estimator/{ → 1}/default.nix
  2. +27 −0 pkgs/development/python-modules/tensorflow-estimator/2/default.nix
  3. 0 pkgs/development/python-modules/tensorflow-tensorboard/{ → 1}/default.nix
  4. +68 −0 pkgs/development/python-modules/tensorflow-tensorboard/2/default.nix
  5. +2 −2 pkgs/development/python-modules/tensorflow/{ → 1}/bin.nix
  6. 0 pkgs/development/python-modules/tensorflow/{ → 1}/binary-hashes.nix
  7. +9 −10 pkgs/development/python-modules/tensorflow/{ → 1}/default.nix
  8. 0 pkgs/development/python-modules/tensorflow/{ → 1}/lift-gast-restriction.patch
  9. 0 pkgs/development/python-modules/tensorflow/{ → 1}/prefetcher.sh
  10. +179 −0 pkgs/development/python-modules/tensorflow/2/bin.nix
  11. +51 −0 pkgs/development/python-modules/tensorflow/2/binary-hashes.nix
  12. +424 −0 pkgs/development/python-modules/tensorflow/2/default.nix
  13. +11 −0 pkgs/development/python-modules/tensorflow/2/lift-gast-restriction.patch
  14. +44 −0 pkgs/development/python-modules/tensorflow/2/prefetcher.sh
  15. 0 pkgs/development/tools/build-managers/bazel/{bazel_0 → bazel_0_26}/default.nix
  16. 0 pkgs/development/tools/build-managers/bazel/{bazel_0 → bazel_0_26}/glibc.patch
  17. 0 pkgs/development/tools/build-managers/bazel/{bazel_0 → bazel_0_26}/python-stub-path-fix.patch
  18. +559 −0 pkgs/development/tools/build-managers/bazel/bazel_0_29/default.nix
  19. +78 −0 pkgs/development/tools/build-managers/bazel/bazel_0_29/glibc.patch
  20. +506 −0 pkgs/development/tools/build-managers/bazel/bazel_0_29/src-deps.json
  21. +12 −1 pkgs/top-level/all-packages.nix
  22. +36 −5 pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{ stdenv, fetchPypi, buildPythonPackage
, numpy
, absl-py
, absl-py
, mock
}:

buildPythonPackage rec {
pname = "tensorflow-estimator";
# This is effectively 1.15.0. Upstream tagged 1.15.0 by mistake before actually updating the version in setup.py, which is why this tag is called 1.15.1.
# This is effectively 1.15.0. Upstream tagged 1.15.0 by mistake before
# actually updating the version in setup.py, which is why this tag is called
# 1.15.1.
version = "1.15.1";
format = "wheel";

27 changes: 27 additions & 0 deletions pkgs/development/python-modules/tensorflow-estimator/2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ stdenv, fetchPypi, buildPythonPackage
, numpy
, absl-py
, mock
}:

buildPythonPackage rec {
pname = "tensorflow-estimator";
version = "2.1.0";
format = "wheel";

src = fetchPypi {
pname = "tensorflow_estimator";
inherit version format;
sha256 = "0wk9viil54ms1s2ir7zxygqa425i69hx8zngwhdqvw9nlr4gdig5";
};

propagatedBuildInputs = [ mock numpy absl-py ];

meta = with stdenv.lib; {
description = "TensorFlow Estimator is a high-level API that encapsulates model training, evaluation, prediction, and exporting.";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ jyp ];
};
}

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

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

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

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

propagatedBuildInputs = [
numpy
werkzeug
protobuf
markdown
grpcio
absl-py
google-auth-oauthlib
# 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 ];
};
}
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
, grpcio
, mock
, backports_weakref
, tensorflow-estimator
, tensorflow-estimator_1
, tensorflow-tensorboard
, cudaSupport ? false
, cudatoolkit ? null
@@ -72,7 +72,7 @@ in buildPythonPackage {
gast
google-pasta
wrapt
tensorflow-estimator
tensorflow-estimator_1
tensorflow-tensorboard
keras-applications
keras-preprocessing
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
, 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
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;
179 changes: 179 additions & 0 deletions pkgs/development/python-modules/tensorflow/2/bin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{ stdenv
, lib
, fetchurl
, buildPythonPackage
, isPy3k, pythonOlder, isPy38
, astor
, gast
, google-pasta
, wrapt
, numpy
, six
, termcolor
, protobuf
, absl-py
, grpcio
, mock
, scipy
, wheel
, opt-einsum
, backports_weakref
, tensorflow-estimator_2
, 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;
platform = if stdenv.isDarwin then "mac" else "linux";
unit = if cudaSupport then "gpu" else "cpu";
key = "${platform}_py_${pyVerNoDot}_${unit}";
in fetchurl packages.${key};

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

nativeBuildInputs = [ wheel ] ++ lib.optional cudaSupport addOpenGLRunpath;

preConfigure = ''
unset SOURCE_DATE_EPOCH
# Make sure that dist and the wheel file are writable.
chmod u+rwx -R ./dist
pushd dist
# Unpack the wheel file.
wheel unpack --dest unpacked ./*.whl
# Tensorflow has a hard dependency on gast==0.2.2, but we relax it to
# gast==0.3.2.
substituteInPlace ./unpacked/tensorflow*/tensorflow_core/tools/pip_package/setup.py --replace "gast == 0.2.2" "gast == 0.3.2"
substituteInPlace ./unpacked/tensorflow*/tensorflow_*.dist-info/METADATA --replace "gast (==0.2.2)" "gast (==0.3.2)"
# Pack the wheel file back up.
wheel pack ./unpacked/tensorflow*
popd
'';

# 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
# rpaths we only need to add if CUDA is enabled.
cudapaths = lib.optionals cudaSupport [
cudatoolkit.out
cudatoolkit.lib
cudnn
nvidia_x11
];

libpaths = [
stdenv.cc.cc.lib
zlib
];

rpath = stdenv.lib.makeLibraryPath (libpaths ++ cudapaths);
in
lib.optionalString stdenv.isLinux ''
# This is an array containing all the directories in the tensorflow2
# package that contain .so files.
#
# TODO: Create this list programmatically, and remove paths that aren't
# actually needed.
rrPathArr=(
"$out/${python.sitePackages}/tensorflow_core/"
"$out/${python.sitePackages}/tensorflow_core/compiler/tf2tensorrt/"
"$out/${python.sitePackages}/tensorflow_core/compiler/tf2xla/ops/"
"$out/${python.sitePackages}/tensorflow_core/lite/experimental/microfrontend/python/ops/"
"$out/${python.sitePackages}/tensorflow_core/lite/python/interpreter_wrapper/"
"$out/${python.sitePackages}/tensorflow_core/lite/python/optimize/"
"$out/${python.sitePackages}/tensorflow_core/python/"
"$out/${python.sitePackages}/tensorflow_core/python/framework/"
"${rpath}"
)
# The the bash array into a colon-separated list of RPATHs.
rrPath=$(IFS=$':'; echo "''${rrPathArr[*]}")
echo "about to run patchelf with the following rpath: $rrPath"
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
echo "about to patchelf $lib..."
chmod a+rx "$lib"
patchelf --set-rpath "$rrPath" "$lib"
${lib.optionalString cudaSupport ''
addOpenGLRunpath "$lib"
''}
done
'';

pythonImportsCheck = [
"tensorflow"
"tensorflow.keras"
"tensorflow.python"
"tensorflow.python.framework"
];

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 cdepillabout ];
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;
};
}
Loading