git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #59363 from timokau/graph_nets-init

python.pkgs.{tensorflow-probability,dm-sonnet,graph_nets}: init

commit05a53ecd827c5910e34171e7681c56913b29add1 authorTimo Kaufmann <timokau@zoho.com> dateSat 13 Apr 2019, 23:12 (8 years ago) parent77dcb9ed88406a
4 files changed+179
pkgs/development/python-modules/dm-sonnet/default.nix+85 pkgs/development/python-modules/graph_nets/default.nix+47 pkgs/development/python-modules/tensorflow-probability/default.nix+41 pkgs/top-level/python-packages.nix+6
pkgs/development/python-modules/dm-sonnet/default.nixnew file+85
@@ -0,0 +1,85 @@
1+{ lib
2+, fetchFromGitHub
3+, buildBazelPackage
4+, buildPythonPackage
5+, git
6+, python
7+, six
8+, absl-py
9+, semantic-version
10+, contextlib2
11+, wrapt
12+, tensorflow
13+, tensorflow-probability
14+}:
15+
16+let
17+ version = "1.30";
18+
19+ # first build all binaries and generate setup.py using bazel
20+ bazel-build = buildBazelPackage rec {
21+ name = "dm-sonnet-bazel-${version}";
22+
23+ src = fetchFromGitHub {
24+ owner = "deepmind";
25+ repo = "sonnet";
26+ rev = "v${version}";
27+ sha256 = "1dli4a4arx2gmb4p676pfibvnpag9f13znisrk9381g7xpqqmaw6";
28+ };
29+
30+ nativeBuildInputs = [
31+ git # needed to fetch the bazel deps (protobuf in particular)
32+ ];
33+
34+ # see https://github.com/deepmind/sonnet/blob/master/docs/INSTALL.md
35+ bazelTarget = ":install";
36+
37+ fetchAttrs = {
38+ sha256 = "1qwq6xp6gdmy8f0k96q3nsgqs56adrbgq39g5smwik6griwfx9mr";
39+ };
40+
41+ buildAttrs = {
42+ preBuild = ''
43+ patchShebangs .
44+ '';
45+
46+ installPhase = ''
47+ # do not generate a wheel, instead just copy the generated files to $out to be installed by buildPythonPackage
48+ sed -i 's,.*bdist_wheel.*,cp -rL . "$out"; exit 0,' bazel-bin/install
49+
50+ # the target directory "dist" does not actually matter since we're not generating a wheel
51+ bazel-bin/install dist
52+ '';
53+ };
54+ };
55+
56+# now use pip to install the package prepared by bazel
57+in buildPythonPackage rec {
58+ pname = "dm-sonnet";
59+ inherit version;
60+
61+ src = bazel-build;
62+
63+ propagatedBuildInputs = [
64+ six
65+ absl-py
66+ semantic-version
67+ contextlib2
68+ wrapt
69+ tensorflow
70+ tensorflow-probability
71+ ];
72+
73+ # not sure how to properly run the real test suite -- through bazel?
74+ checkPhase = ''
75+ ${python.interpreter} -c "import sonnet"
76+ '';
77+
78+ meta = with lib; {
79+ description = "TensorFlow-based neural network library";
80+ homepage = https://sonnet.dev;
81+ license = licenses.asl20;
82+ maintainers = with maintainers; [ timokau ];
83+ platforms = platforms.linux;
84+ };
85+}
pkgs/development/python-modules/graph_nets/default.nixnew file+47
@@ -0,0 +1,47 @@
1+{ lib
2+, buildPythonPackage
3+, fetchPypi
4+, tensorflow
5+, absl-py
6+, dm-sonnet
7+, networkx
8+, numpy
9+, setuptools
10+, six
11+, future
12+}:
13+
14+buildPythonPackage rec {
15+ pname = "graph_nets";
16+ version = "1.0.3";
17+
18+ src = fetchPypi {
19+ inherit pname version;
20+ sha256 = "15cbs9smmgqz2n9mnlzdbqj3iv9iw179d2g0f9lnimdy7xl4jqdf";
21+ };
22+
23+ buildInputs = [];
24+
25+ postPatch = ''
26+ # https://github.com/deepmind/graph_nets/issues/63
27+ sed -i 's/dm-sonnet==1.23/dm-sonnet/' setup.py
28+ '';
29+
30+ propagatedBuildInputs = [
31+ tensorflow
32+ absl-py
33+ dm-sonnet
34+ networkx
35+ numpy
36+ setuptools
37+ six
38+ future
39+ ];
40+
41+ meta = with lib; {
42+ description = "Build Graph Nets in Tensorflow";
43+ homepage = https://github.com/deepmind/graph_nets;
44+ license = licenses.asl20;
45+ maintainers = with maintainers; [ timokau ];
46+ };
47+}
pkgs/development/python-modules/tensorflow-probability/default.nixnew file+41
@@ -0,0 +1,41 @@
1+{ lib
2+, fetchFromGitHub
3+, buildPythonPackage
4+, tensorflow
5+, pytest
6+}:
7+
8+buildPythonPackage rec {
9+ pname = "tensorflow-probability";
10+ version = "0.6.0";
11+
12+ src = fetchFromGitHub {
13+ owner = "tensorflow";
14+ repo = "probability";
15+ rev = "v${version}";
16+ sha256 = "1y210n4asv8j39pk68bdfrz01gddflvzhxbcvj5jw6rjgaagnhvx";
17+ };
18+
19+ propagatedBuildInputs = [
20+ tensorflow
21+ ];
22+
23+ checkInputs = [
24+ pytest
25+ ];
26+
27+ # Tests have an invalid import (`tensorflow_probability.opensource`), should
28+ # be resolved in the next version with
29+ # https://github.com/tensorflow/probability/commit/77d5957f2f0bdddcb46582799cd9c5c5167a1a40
30+ doCheck = false;
31+ checkPhase = ''
32+ py.test
33+ '';
34+
35+ meta = with lib; {
36+ description = "Library for probabilistic reasoning and statistical analysis";
37+ homepage = https://www.tensorflow.org/probability/;
38+ license = licenses.asl20;
39+ maintainers = with maintainers; [ timokau ];
40+ };
41+}
pkgs/top-level/python-packages.nix+6
@@ -4877,6 +4877,8 @@ in {
48774877
48784878 graphite_beacon = callPackage ../development/python-modules/graphite_beacon { };
48794879
4880+ graph_nets = callPackage ../development/python-modules/graph_nets { };
4881+
48804882 influxgraph = callPackage ../development/python-modules/influxgraph { };
48814883
48824884 graphitepager = callPackage ../development/python-modules/graphitepager { };
@@ -4927,6 +4929,8 @@ in {
49274929
49284930 snapperGUI = callPackage ../development/python-modules/snappergui { };
49294931
4932+ dm-sonnet = callPackage ../development/python-modules/dm-sonnet { };
4933+
49304934 uncertainties = callPackage ../development/python-modules/uncertainties { };
49314935
49324936 funcy = callPackage ../development/python-modules/funcy { };
@@ -5143,6 +5147,8 @@ in {
51435147
51445148 tensorflow-estimator = callPackage ../development/python-modules/tensorflow-estimator { };
51455149
5150+ tensorflow-probability = callPackage ../development/python-modules/tensorflow-probability { };
5151+
51465152 tensorflow-tensorboard = callPackage ../development/python-modules/tensorflow-tensorboard { };
51475153
51485154 tensorflow =