Skip to content

Commit

Permalink
pythonPackages.gast_0_2_2: init for tensorflow
Browse files Browse the repository at this point in the history
It’s been reported that python-gast-0.2.2 is needed for Tensorflow
Autograph. See tensorflow/tensorflow#38734.
  • Loading branch information
matthewbauer committed Jun 4, 2020
1 parent 1471767 commit 32ea29b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 39 deletions.
16 changes: 16 additions & 0 deletions pkgs/development/python-modules/gast/0_2_2.nix
@@ -0,0 +1,16 @@
{ stdenv, fetchPypi, buildPythonPackage, astunparse }:

buildPythonPackage rec {
pname = "gast";
version = "0.2.2";
src = fetchPypi {
inherit pname version;
sha256 = "1w5dzdb3gpcfmd2s0b93d8gff40a1s41rv31458z14inb3s9v4zy";
};
checkInputs = [ astunparse ] ;
meta = with stdenv.lib; {
description = "GAST provides a compatibility layer between the AST of various Python versions, as produced by ast.parse from the standard ast module.";
license = licenses.bsd3;
maintainers = with maintainers; [ jyp ];
};
}
8 changes: 0 additions & 8 deletions pkgs/development/python-modules/tensorflow/1/default.nix
Expand Up @@ -124,14 +124,6 @@ let
sha256 = "1n9ypbrx36fc1kc9cz5b3p9qhg15xxhq4nz6ap3hwqba535nakfz";
})

(fetchpatch {
# be compatible with gast >0.2 instead of only gast 0.2.2
name = "gast-update.patch";
url = "https://github.com/tensorflow/tensorflow/commit/85751ad6c7f5fd12c6c79545d96896cba92fa8b4.patch";
sha256 = "077cpj0kzyqxzdya1dwh8df17zfzhqn7c685hx6iskvw2979zg2n";
})
./lift-gast-restriction.patch

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

This file was deleted.

5 changes: 0 additions & 5 deletions pkgs/development/python-modules/tensorflow/2/bin.nix
Expand Up @@ -96,11 +96,6 @@ in buildPythonPackage {
# 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*
Expand Down
2 changes: 0 additions & 2 deletions pkgs/development/python-modules/tensorflow/2/default.nix
Expand Up @@ -126,8 +126,6 @@ let
excludes = [ "tensorflow/cc/saved_model/BUILD" ];
})

./lift-gast-restriction.patch

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

This file was deleted.

18 changes: 18 additions & 0 deletions pkgs/top-level/python-packages.nix
Expand Up @@ -6930,13 +6930,21 @@ in {
inherit (pkgs.linuxPackages) nvidia_x11;
cudatoolkit = pkgs.cudatoolkit_10;
cudnn = pkgs.cudnn_cudatoolkit_10;

# needed for tensorflow <2.2
# see https://github.com/tensorflow/tensorflow/issues/38734
gast = self.gast_0_2_2;
};

tensorflow-bin_2 = callPackage ../development/python-modules/tensorflow/2/bin.nix {
cudaSupport = pkgs.config.cudaSupport or false;
inherit (pkgs.linuxPackages) nvidia_x11;
cudatoolkit = pkgs.cudatoolkit_10;
cudnn = pkgs.cudnn_cudatoolkit_10;

# needed for tensorflow <2.2
# see https://github.com/tensorflow/tensorflow/issues/38734
gast = self.gast_0_2_2;
};

tensorflow-build = self.tensorflow-build_1;
Expand All @@ -6949,6 +6957,10 @@ in {
nccl = pkgs.nccl_cudatoolkit_10;
openssl = pkgs.openssl_1_1;
inherit (pkgs.darwin.apple_sdk.frameworks) Foundation Security;

# needed for tensorflow <2.2
# see https://github.com/tensorflow/tensorflow/issues/38734
gast = self.gast_0_2_2;
};

tensorflow-build_2 = callPackage ../development/python-modules/tensorflow/2 {
Expand All @@ -6959,6 +6971,10 @@ in {
nccl = pkgs.nccl_cudatoolkit_10;
openssl = pkgs.openssl_1_1;
inherit (pkgs.darwin.apple_sdk.frameworks) Foundation Security;

# needed for tensorflow <2.2
# see https://github.com/tensorflow/tensorflow/issues/38734
gast = self.gast_0_2_2;
};

tensorflow = self.tensorflow_1;
Expand Down Expand Up @@ -7292,6 +7308,8 @@ in {

gast = callPackage ../development/python-modules/gast { };

gast_0_2_2 = callPackage ../development/python-modules/gast/0_2_2.nix { };

ibis = callPackage ../development/python-modules/ibis { };

ibis-framework = callPackage ../development/python-modules/ibis-framework { };
Expand Down

0 comments on commit 32ea29b

Please sign in to comment.