* [bug#33952] Add tensorflow. @ 2019-01-02 16:16 Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus 2019-04-08 12:45 ` [bug#33952] [PATCH v2] " Ricardo Wurmus 0 siblings, 2 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:16 UTC (permalink / raw) To: 33952; +Cc: 31386-done Hi Guix, the following series of patches supersedes #31386. The first two patches are for “tensorflow-core”, which is pretty useless. Everything after that is for the “tensorflow” package, which provides the Python interface people commonly use. The package is horrible, so let’s try to fix this together. I’ve cut a few corners, so I don’t want to add this to Guix as is. We should try to reduce the amount of bundled third-party code. I haven’t been able to test this, because I’ve hit an unrelated bug (the dreaded miscompilation of the info-dir derivation). -- Ricardo ^ permalink raw reply [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow. 2019-01-02 16:16 [bug#33952] Add tensorflow Ricardo Wurmus @ 2019-01-02 16:17 ` Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 02/14] gnu: Add tensorflow-core Ricardo Wurmus ` (8 more replies) 2019-04-08 12:45 ` [bug#33952] [PATCH v2] " Ricardo Wurmus 1 sibling, 9 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:17 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (gemmlowp-for-tensorflow): New variable. --- gnu/packages/machine-learning.scm | 60 ++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 084e62cca..f4e66b9a3 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -58,7 +58,8 @@ #:use-module (gnu packages statistics) #:use-module (gnu packages swig) #:use-module (gnu packages xml) - #:use-module (gnu packages xorg)) + #:use-module (gnu packages xorg) + #:use-module (ice-9 match)) (define-public fann ;; The last release is >100 commits behind, so we package from git. @@ -621,6 +622,63 @@ Support Vector Machines, Spectral Clustering, Kernel PCA, Gaussian Processes and a QP solver.") (license license:gpl2))) +(define-public gemmlowp-for-tensorflow + ;; The commit hash is taken from "tensorflow/workspace.bzl". + (let ((commit "38ebac7b059e84692f53e5938f97a9943c120d98") + (revision "2")) + (package + (name "gemmlowp") + (version (git-version "0" revision commit)) + (source (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/gemmlowp/archive/" + commit ".zip")) + (file-name (string-append "gemmlowp-" version ".zip")) + (sha256 + (base32 + "0n56s2g8hrssm4w8qj1v58gfm56a04n9v992ixkmvk6zjiralzxq")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + (list ,@(match (%current-system) + ((or "x86_64-linux" "i686-linux") + '("-DCMAKE_CXX_FLAGS=-msse4.1")) + (_ '()))) + #:phases + (modify-phases %standard-phases + ;; This directory contains the CMakeLists.txt. + (add-after 'unpack 'chdir + (lambda _ (chdir "contrib") #t)) + ;; There is no install target + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib/")) + (inc (string-append out "/include/"))) + (install-file "../build/libeight_bit_int_gemm.so" lib) + (for-each (lambda (dir) + (let ((target (string-append inc "/" dir))) + (mkdir-p target) + (for-each (lambda (h) + (install-file h target)) + (find-files (string-append "../" dir) + "\\.h$")))) + '("meta" "profiling" "public" "fixedpoint" + "eight_bit_int_gemm" "internal")) + #t)))))) + (native-inputs + `(("unzip" ,unzip))) + (home-page "https://github.com/google/gemmlowp") + (synopsis "Small self-contained low-precision GEMM library") + (description + "This is a small self-contained low-precision @dfn{general matrix +multiplication} (GEMM) library. It is not a full linear algebra library. +Low-precision means that the input and output matrix entries are integers on +at most 8 bits. To avoid overflow, results are internally accumulated on more +than 8 bits, and at the end only some significant 8 bits are kept.") + (license license:asl2.0)))) + (define-public dlib (package (name "dlib") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 02/14] gnu: Add tensorflow-core. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus @ 2019-01-02 16:17 ` Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 03/14] gnu: Add c-ares-next Ricardo Wurmus ` (7 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:17 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (tensorflow-core): New variable. --- gnu/packages/machine-learning.scm | 112 ++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index f4e66b9a3..dd725a609 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -54,6 +54,7 @@ #:use-module (gnu packages onc-rpc) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages statistics) #:use-module (gnu packages swig) @@ -679,6 +680,117 @@ at most 8 bits. To avoid overflow, results are internally accumulated on more than 8 bits, and at the end only some significant 8 bits are kept.") (license license:asl2.0)))) +(define-public tensorflow-core + (package + (name "tensorflow-core") + (version "1.7.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tensorflow/tensorflow.git") + (commit (string-append "v" version)))) + (file-name (string-append "tensorflow-" version "-checkout")) + (sha256 + (base32 + "0jljzbwhmxi8crbivwachcmlfrrv279qrsvwc62cnnbyw0n1g0kp")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; no "check" target + #:make-flags + (list "-f" "tensorflow/contrib/makefile/Makefile" + "CC=gcc") + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'unpack 'fix-version + (lambda _ + (substitute* "tensorflow/tools/git/gen_git_source.sh" + (("^GIT_VERSION=.*") + (string-append "GIT_VERSION=" ,version "\n"))) + #t)) + (add-after 'unpack 'unpack-third-party + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "tensorflow/contrib/makefile/" + (let ((fft2d "downloads/fft2d") + (nsync "downloads/nsync")) + (mkdir-p fft2d) + (invoke "tar" "xf" (assoc-ref inputs "fft2d") + "-C" fft2d "--strip-components=1") + (mkdir-p nsync) + (invoke "tar" "xf" (assoc-ref inputs "nsync") + "-C" nsync "--strip-components=1"))))) + ;; FIXME: it would be nice to build a separate package for nsync and + ;; use it here. Unfortunately, I could not build Tensorflow with a + ;; separately built nsync. + (add-before 'build 'build-nsync + (lambda _ + (with-directory-excursion "tensorflow/contrib/makefile/" + (invoke "bash" "compile_nsync.sh") + (setenv "TARGET_NSYNC_LIB" + "tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/nsync.a") + (setenv "HOST_NSYNC_LIB" + "tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/nsync.a") + #t))) + (add-after 'unpack 'find-eigen-headers + (lambda* (#:key inputs #:allow-other-keys) + ;; Ensure that Eigen headers can be found + (setenv "CPLUS_INCLUDE_PATH" + (string-append (getenv "CPLUS_INCLUDE_PATH") + ":" + (assoc-ref inputs "eigen") + "/include/eigen3")) + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib")) + (inc (string-append out "/include"))) + (install-file "tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a" lib) + (for-each (lambda (file) + (let ((target (string-append inc "/" + (dirname file)))) + (mkdir-p target) + (install-file file target))) + (find-files "tensorflow/core" ".*\\.h$")) + #t)))))) + (native-inputs + `(("protobuf" ,protobuf) ; protoc + ;; "You may use, copy, modify this code for any purpose and without + ;; fee. You may distribute this ORIGINAL package." + ("fft2d" + ,(origin + (method url-fetch) + (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz") + (sha256 + (base32 + "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj")))) + ("nsync" + ,(origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/nsync/archive/" + "0559ce013feac8db639ee1bf776aca0325d28777.tar.gz")) + (sha256 + (base32 + "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132")))) + ("googletest" ,googletest))) + (inputs + `(("eigen" ,eigen) + ("gemmlowp" ,gemmlowp-for-tensorflow) + ("protobuf" ,protobuf) + ("zlib" ,zlib))) + (home-page "https://tensorflow.org") + (synopsis "Machine learning framework") + (description + "TensorFlow is a software library for high performance numerical +computation. Its flexible architecture allows easy deployment of computation +across a variety of platforms, and from desktops to clusters of servers to +mobile and edge devices. + +This package provides only the core library.") + (license license:asl2.0))) + (define-public dlib (package (name "dlib") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 03/14] gnu: Add c-ares-next. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 02/14] gnu: Add tensorflow-core Ricardo Wurmus @ 2019-01-02 16:17 ` Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 04/14] gnu: Add protobuf-next Ricardo Wurmus ` (6 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:17 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/adns.scm (c-ares-next): New variable. --- gnu/packages/adns.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gnu/packages/adns.scm b/gnu/packages/adns.scm index 6e3af8b2d..28a65667e 100644 --- a/gnu/packages/adns.scm +++ b/gnu/packages/adns.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2016, 2018 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +22,7 @@ #:use-module (guix licenses) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (gnu packages pkg-config)) @@ -80,3 +82,33 @@ queries without blocking, or need to perform multiple DNS queries in parallel. The primary examples of such applications are servers which communicate with multiple clients and programs with graphical user interfaces.") (license (x11-style "https://c-ares.haxx.se/license.html")))) + +;; XXX: temporary package for tensorflow / grpc +(define-public c-ares-next + (package + (name "c-ares") + (version "1.15.0") + (source (origin + (method url-fetch) + (uri (string-append + "https://c-ares.haxx.se/download/" name "-" version + ".tar.gz")) + (sha256 + (base32 + "0lk8knip4xk6qzksdkn7085mmgm4ixfczdyyjw656c193y3rgnvc")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; some tests seem to require Internet connection + #:configure-flags + (list "-DCARES_BUILD_TESTS=ON"))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (home-page "https://c-ares.haxx.se/") + (synopsis "C library for asynchronous DNS requests") + (description + "C-ares is a C library that performs DNS requests and name resolution +asynchronously. It is intended for applications which need to perform DNS +queries without blocking, or need to perform multiple DNS queries in parallel. +The primary examples of such applications are servers which communicate with +multiple clients and programs with graphical user interfaces.") + (license (x11-style "https://c-ares.haxx.se/license.html")))) -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 04/14] gnu: Add protobuf-next. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 02/14] gnu: Add tensorflow-core Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 03/14] gnu: Add c-ares-next Ricardo Wurmus @ 2019-01-02 16:17 ` Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 05/14] gnu: Add grpc Ricardo Wurmus ` (5 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:17 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/protobuf.scm (protobuf-next): New variable. --- gnu/packages/protobuf.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm index 85e3170b9..a25038ef4 100644 --- a/gnu/packages/protobuf.scm +++ b/gnu/packages/protobuf.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Daniel Pimentel <d4n1@d4n1.org> ;;; Copyright © 2016 Leo Famulari <leo@famulari.name> -;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> ;;; ;;; This file is part of GNU Guix. @@ -108,6 +108,19 @@ yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats.") (license license:bsd-3))) +(define-public protobuf-next + (package (inherit protobuf) + (name "protobuf") + (version "3.6.1") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/google/protobuf/releases/" + "download/v" version "/protobuf-cpp-" + version ".tar.gz")) + (sha256 + (base32 + "0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk")))))) + ;; XXX Remove this old version when no other packages depend on it. (define-public protobuf-2 (package (inherit protobuf) -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 05/14] gnu: Add grpc. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus ` (2 preceding siblings ...) 2019-01-02 16:17 ` [bug#33952] [PATCH 04/14] gnu: Add protobuf-next Ricardo Wurmus @ 2019-01-02 16:17 ` Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 06/14] gnu: Add graphviz-2.38 Ricardo Wurmus ` (4 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:17 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (grpc): New variable. --- gnu/packages/machine-learning.scm | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index dd725a609..d3310ac83 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -39,6 +39,7 @@ #:use-module (guix build-system r) #:use-module (guix git-download) #:use-module (gnu packages) + #:use-module (gnu packages adns) #:use-module (gnu packages algebra) #:use-module (gnu packages autotools) #:use-module (gnu packages boost) @@ -58,6 +59,7 @@ #:use-module (gnu packages python) #:use-module (gnu packages statistics) #:use-module (gnu packages swig) + #:use-module (gnu packages tls) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (ice-9 match)) @@ -791,6 +793,44 @@ mobile and edge devices. This package provides only the core library.") (license license:asl2.0))) +(define-public grpc + (package + (name "grpc") + (version "1.16.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/grpc/grpc.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; no test target + #:configure-flags + (list "-DgRPC_ZLIB_PROVIDER=package" + "-DgRPC_CARES_PROVIDER=package" + "-DgRPC_SSL_PROVIDER=package" + "-DgRPC_PROTOBUF_PROVIDER=package"))) + (inputs + `(("c-ares" ,c-ares-next) + ("openssl" ,openssl) + ("zlib" ,zlib))) + (native-inputs + `(("protobuf" ,protobuf-next) + ("python" ,python-wrapper))) + (home-page "https://grpc.io") + (synopsis "High performance universal RPC framework") + (description "gRPC is a modern open source high performance @dfn{Remote +Procedure Call} (RPC) framework that can run in any environment. It can +efficiently connect services in and across data centers with pluggable support +for load balancing, tracing, health checking and authentication. It is also +applicable in last mile of distributed computing to connect devices, mobile +applications and browsers to backend services.") + (license license:asl2.0))) + (define-public dlib (package (name "dlib") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 06/14] gnu: Add graphviz-2.38. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus ` (3 preceding siblings ...) 2019-01-02 16:17 ` [bug#33952] [PATCH 05/14] gnu: Add grpc Ricardo Wurmus @ 2019-01-02 16:17 ` Ricardo Wurmus 2019-01-02 16:18 ` [bug#33952] [PATCH 07/14] gnu: Add python-doctest-ignore-unicode Ricardo Wurmus ` (3 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:17 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/graphviz.scm (graphviz-2.38): New variable. --- gnu/packages/graphviz.scm | 51 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm index 569923d4e..47342b784 100644 --- a/gnu/packages/graphviz.scm +++ b/gnu/packages/graphviz.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org> -;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com> ;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org> @@ -27,7 +27,10 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system python) #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix utils) #:use-module (gnu packages xorg) + #:use-module (gnu packages flex) #:use-module (gnu packages gtk) #:use-module (gnu packages xml) #:use-module (gnu packages glib) @@ -35,6 +38,7 @@ #:use-module (gnu packages bison) #:use-module (gnu packages image) #:use-module (gnu packages autotools) + #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages glib) #:use-module (gnu packages gtk) @@ -43,6 +47,7 @@ #:use-module (gnu packages compression) #:use-module (gnu packages gd) #:use-module (gnu packages swig) + #:use-module (gnu packages tcl) #:use-module (gnu packages python) #:use-module (gnu packages tex) #:use-module ((guix licenses) #:prefix license:)) @@ -114,6 +119,50 @@ software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.") (license license:epl1.0))) +;; Older Graphviz needed for pygraphviz. See +;; https://github.com/pygraphviz/pygraphviz/issues/175 +(define-public graphviz-2.38 + ;; This commit corresponds to the changelog change for version 2.38.0. + ;; There are no tags. + (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126") + (revision "1")) + (package (inherit graphviz) + (name "graphviz") + (version (git-version "2.38.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.com/graphviz/graphviz.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x")))) + (arguments + (substitute-keyword-arguments (package-arguments graphviz) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'prepare-bootstrap + (lambda _ + (substitute* "autogen.sh" + (("/bin/sh") (which "sh")) + (("\\$GRAPHVIZ_VERSION_DATE") "0")) + (setenv "CONFIG_SHELL" (which "sh")) + (setenv "SHELL" (which "sh")) + + (map make-file-writable (find-files "." ".*")) + #t)) + (replace 'bootstrap + (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t)))))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ("flex" ,flex) + ("perl" ,perl) + ("tcl" ,tcl) + ,@(package-native-inputs graphviz)))))) + (define-public python-graphviz (package (name "python-graphviz") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 07/14] gnu: Add python-doctest-ignore-unicode. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus ` (4 preceding siblings ...) 2019-01-02 16:17 ` [bug#33952] [PATCH 06/14] gnu: Add graphviz-2.38 Ricardo Wurmus @ 2019-01-02 16:18 ` Ricardo Wurmus 2019-01-02 16:18 ` [bug#33952] [PATCH 08/14] gnu: Add python-graphviz Ricardo Wurmus ` (2 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:18 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/python.scm (python-doctest-ignore-unicode): New variable. --- gnu/packages/python.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index ad5c56427..4e9e19585 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -15111,6 +15111,27 @@ RFC 8265 and RFC 8266.") (properties '((upstream-name . "Wikidata"))) (license license:gpl3+))) +(define-public python-doctest-ignore-unicode + (package + (name "python-doctest-ignore-unicode") + (version "0.1.2") + (source + (origin + (method url-fetch) + (uri (pypi-uri "doctest-ignore-unicode" version)) + (sha256 + (base32 + "1m9aa4qnyj21lbq4sbvmv1vcz7zksss4rz37ddf2hxv4hk8b547w")))) + (build-system python-build-system) + (native-inputs + `(("python-nose" ,python-nose))) + (home-page "https://github.com/gnublade/doctest-ignore-unicode") + (synopsis "Ignore Unicode literal prefixes in doctests") + (description + "This package adds support for a flag to ignore Unicode literal prefixes +in doctests.") + (license license:asl2.0))) + (define-public python-attr (package (name "python-attr") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 08/14] gnu: Add python-graphviz. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus ` (5 preceding siblings ...) 2019-01-02 16:18 ` [bug#33952] [PATCH 07/14] gnu: Add python-doctest-ignore-unicode Ricardo Wurmus @ 2019-01-02 16:18 ` Ricardo Wurmus 2019-01-02 16:18 ` [bug#33952] [PATCH 09/14] gnu: Add python-absl-py Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:18 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/graphviz.scm (python-graphviz): New variable. --- gnu/packages/graphviz.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm index 47342b784..42f793b48 100644 --- a/gnu/packages/graphviz.scm +++ b/gnu/packages/graphviz.scm @@ -29,6 +29,7 @@ #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) + #:use-module (gnu packages check) #:use-module (gnu packages xorg) #:use-module (gnu packages flex) #:use-module (gnu packages gtk) @@ -186,6 +187,40 @@ visualization tool suite.") (define-public python2-graphviz (package-with-python2 python-graphviz)) +(define-public python-pygraphviz + (package + (name "python-pygraphviz") + (version "1.5") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pygraphviz/pygraphviz.git") + (commit (string-append "pygraphviz-" version)))) + (file-name (string-append "pygraphviz-" version "-checkout")) + (sha256 + (base32 + "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp")))) + (build-system python-build-system) + (arguments + `(#:configure-flags + (let ((graphviz (assoc-ref %build-inputs "graphviz"))) + (list (string-append "--include-path=" graphviz "/include") + (string-append "--library-path=" graphviz "/lib"))))) + (inputs + `(("graphviz" ,graphviz-2.38))) + (native-inputs + `(("python-nose" ,python-nose) + ("python-mock" ,python-mock) + ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode))) + (home-page "http://pygraphviz.github.io") + (synopsis "Python interface to Graphviz") + (description "PyGraphviz is a Python interface to the Graphviz graph +layout and visualization package. With PyGraphviz you can create, edit, read, +write, and draw graphs using Python to access the Graphviz graph data +structure and layout algorithms.") + (license license:bsd-3))) + (define-public gts (package (name "gts") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 09/14] gnu: Add python-absl-py. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus ` (6 preceding siblings ...) 2019-01-02 16:18 ` [bug#33952] [PATCH 08/14] gnu: Add python-graphviz Ricardo Wurmus @ 2019-01-02 16:18 ` Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus 8 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:18 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/python.scm (python-absl-py): New variable. --- gnu/packages/python.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 4e9e19585..ac8de1160 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -15089,6 +15089,27 @@ on regular expressions.") RFC 8265 and RFC 8266.") (license license:expat))) +(define-public python-absl-py + (package + (name "python-absl-py") + (version "0.6.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "absl-py" version)) + (sha256 + (base32 + "1mp9lk0b2qa37b7y6ak4lvf6ifw2ylyy6bkf9ik77md3j4xrwlc7")))) + (build-system python-build-system) + (propagated-inputs + `(("python-six" ,python-six))) + (home-page "https://github.com/abseil/abseil-py") + (synopsis "Abseil Python common libraries") + (description + "This package provides the Abseil Python Common Libraries, a collection +of Python libraries for building Python applications.") + (license license:asl2.0))) + (define-public python-wikidata (package (name "python-wikidata") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 10/14] gnu: Add python-astor. 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus ` (7 preceding siblings ...) 2019-01-02 16:18 ` [bug#33952] [PATCH 09/14] gnu: Add python-absl-py Ricardo Wurmus @ 2019-01-02 16:25 ` Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 11/14] gnu: Add python-astunparse Ricardo Wurmus ` (3 more replies) 8 siblings, 4 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:25 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/python.scm (python-astor): New variable. --- gnu/packages/python.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index ac8de1160..541861b75 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -15110,6 +15110,26 @@ RFC 8265 and RFC 8266.") of Python libraries for building Python applications.") (license license:asl2.0))) +(define-public python-astor + (package + (name "python-astor") + (version "0.7.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "astor" version)) + (sha256 + (base32 + "13gv6f2xz9i564byp21gcpc0l3w4cs23k1wbcam8kky2ls3hvhwm")))) + (build-system python-build-system) + ;; FIXME: There are two errors and two test failures. + (arguments `(#:tests? #f)) + (home-page "https://github.com/berkerpeksag/astor") + (synopsis "Read/rewrite/write Python ASTs") + (description "Astor is designed to allow easy manipulation of Python +source via the AST.") + (license license:bsd-3))) + (define-public python-wikidata (package (name "python-wikidata") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 11/14] gnu: Add python-astunparse. 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus @ 2019-01-02 16:25 ` Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 12/14] gnu: Add python-gast Ricardo Wurmus ` (2 subsequent siblings) 3 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:25 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/python.scm (python-astunparse): New variable. --- gnu/packages/python.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 541861b75..93189d143 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -15130,6 +15130,29 @@ of Python libraries for building Python applications.") source via the AST.") (license license:bsd-3))) +(define-public python-astunparse + (package + (name "python-astunparse") + (version "1.6.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "astunparse" version)) + (sha256 + (base32 + "1jhidwyrqn17avqh9xnnm3wd7q7aahaq009cba67g86y6gxicyyj")))) + (build-system python-build-system) + (arguments '(#:tests? #f)) ; there are none + (propagated-inputs + `(("python-six" ,python-six) + ("python-wheel" ,python-wheel))) + (home-page "https://github.com/simonpercivall/astunparse") + (synopsis "AST unparser for Python") + (description "This package provides an AST unparser for Python. It is a +factored out version of @code{unparse} found in the Python source +distribution.") + (license license:bsd-3))) + (define-public python-wikidata (package (name "python-wikidata") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 12/14] gnu: Add python-gast. 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 11/14] gnu: Add python-astunparse Ricardo Wurmus @ 2019-01-02 16:25 ` Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 13/14] gnu: Add python-grpcio Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 14/14] gnu: Add tensorflow Ricardo Wurmus 3 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:25 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/python.scm (python-gast): New variable. --- gnu/packages/python.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 93189d143..64d4b25ce 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -15153,6 +15153,28 @@ factored out version of @code{unparse} found in the Python source distribution.") (license license:bsd-3))) +(define-public python-gast + (package + (name "python-gast") + (version "0.2.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "gast" version)) + (sha256 + (base32 + "0c296xm1vz9x4w4inmdl0k8mnc0i9arw94si2i7pglpc461r0s3h")))) + (build-system python-build-system) + (propagated-inputs + `(("python-astunparse" ,python-astunparse))) + (home-page "https://pypi.org/project/gast/") + (synopsis "Generic Python AST that abstracts the underlying Python version") + (description + "GAST provides a compatibility layer between the AST of various Python +versions, as produced by @code{ast.parse} from the standard @code{ast} +module.") + (license license:bsd-3))) + (define-public python-wikidata (package (name "python-wikidata") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 13/14] gnu: Add python-grpcio. 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 11/14] gnu: Add python-astunparse Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 12/14] gnu: Add python-gast Ricardo Wurmus @ 2019-01-02 16:25 ` Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 14/14] gnu: Add tensorflow Ricardo Wurmus 3 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:25 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (python-grpcio): New variable. --- gnu/packages/machine-learning.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index d3310ac83..870ca7c4d 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -831,6 +831,26 @@ applicable in last mile of distributed computing to connect devices, mobile applications and browsers to backend services.") (license license:asl2.0))) +(define-public python-grpcio + (package + (name "python-grpcio") + (version "1.17.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "grpcio" version)) + (sha256 + (base32 + "0qb9y6j83nxa6d4kc60i8yfgdm7a8ms7b54kncjzf5y7nsxp8rzx")))) + (build-system python-build-system) + (propagated-inputs + `(("python-six" ,python-six))) + (home-page "https://grpc.io") + (synopsis "HTTP/2-based RPC framework") + (description "This package provides a Python library for communicating +with the HTTP/2-based RPC framework gRPC.") + (license license:asl2.0))) + (define-public dlib (package (name "dlib") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH 14/14] gnu: Add tensorflow. 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus ` (2 preceding siblings ...) 2019-01-02 16:25 ` [bug#33952] [PATCH 13/14] gnu: Add python-grpcio Ricardo Wurmus @ 2019-01-02 16:25 ` Ricardo Wurmus 3 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-01-02 16:25 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (tensorflow): New variable. --- gnu/packages/machine-learning.scm | 482 ++++++++++++++++++++++++++++++ 1 file changed, 482 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 870ca7c4d..4664b2099 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -46,6 +46,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cran) + #:use-module (gnu packages databases) #:use-module (gnu packages dejagnu) #:use-module (gnu packages gcc) #:use-module (gnu packages image) @@ -851,6 +852,487 @@ applications and browsers to backend services.") with the HTTP/2-based RPC framework gRPC.") (license license:asl2.0))) +(define-public tensorflow + (package + (name "tensorflow") + (version "1.9.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tensorflow/tensorflow.git") + (commit (string-append "v" version)))) + (file-name (string-append "tensorflow-" version "-checkout")) + (sha256 + (base32 + "0a9kwha395g3wgxfwln5j8vn9nkspmd75xldrlqdq540w996g8xa")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; no "check" target + #:build-type "Release" + #:configure-flags + (let ((protobuf (assoc-ref %build-inputs "protobuf")) + (snappy (assoc-ref %build-inputs "snappy")) + (sqlite (assoc-ref %build-inputs "sqlite"))) + (list ;; TODO: Use protobuf from Guix + ;; (string-append "-Dprotobuf_STATIC_LIBRARIES=" + ;; protobuf "/lib/libprotobuf.a") + (string-append "-DPROTOBUF_PROTOC_EXECUTABLE=" + protobuf "/bin/protoc") + ;; TODO: Use snappy from Guix + ;; (string-append "-Dsnappy_STATIC_LIBRARIES=" + ;; snappy "/lib/libsnappy.a") + ;; (string-append "-Dsnappy_HEADERS=" + ;; snappy "/include/snappy.h") + ;; TODO: this is ignored. Should be a definition in code. + ;;"-DTF_USE_SNAPPY" + ;; Use sqlite from Guix + (string-append "-Dsqlite_STATIC_LIBRARIES=" + sqlite "/lib/libsqlite.a") + (string-append "-Dsqlite_HEADERS=" + sqlite "/include/sqlite3.h " + sqlite "/include/sqlite3ext.h") + ;; Use system libraries wherever possible. Currently, this + ;; only affects zlib. + "-Dsystemlib_ALL=ON" + + ;;"-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" + "-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON" + "-Dtensorflow_BUILD_SHARED_LIB=ON" + "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=OFF" + "-Dtensorflow_ENABLE_SSL_SUPPORT=OFF" + "-Dtensorflow_BUILD_CONTRIB_KERNELS=OFF")) + #:make-flags + (list "CC=gcc") + #:modules ((ice-9 ftw) + (guix build utils) + (guix build cmake-build-system)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'set-source-file-times-to-1980 + ;; At the end of the tf_python_build_pip_package target, a ZIP + ;; archive should be generated via bdist_wheel, but it fails with + ;; "ZIP does not support timestamps before 1980". Luckily, + ;; SOURCE_DATE_EPOCH is respected, which we set to some time in + ;; 1980. + (lambda _ (setenv "SOURCE_DATE_EPOCH" "315532800") #t)) + ;; See https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-406373913 + (add-after 'unpack 'python3.7-compatibility + (lambda _ + (substitute* '("tensorflow/python/eager/pywrap_tfe_src.cc" + "tensorflow/python/lib/core/ndarray_tensor.cc" + "tensorflow/python/lib/core/py_func.cc") + (("PyUnicode_AsUTF8") "(char *)PyUnicode_AsUTF8")) + (substitute* "tensorflow/c/eager/c_api.h" + (("unsigned char async") + "unsigned char is_async")) + + ;; Remove dependency on tensorboard, a complicated but probably + ;; optional package. + (substitute* "tensorflow/tools/pip_package/setup.py" + ((".*'tensorboard >.*") "")) + #t)) + (add-after 'python3.7-compatibility 'chdir + (lambda _ (chdir "tensorflow/contrib/cmake") #t)) + (add-after 'chdir 'disable-downloads + (lambda* (#:key inputs #:allow-other-keys) + (substitute* (find-files "external" "\\.cmake$") + (("GIT_REPOSITORY.*") "") + (("GIT_TAG.*") "") + (("PREFIX ") + "DOWNLOAD_COMMAND \"\"\nPREFIX ")) + + ;; Use packages from Guix + (let ((grpc (assoc-ref inputs "grpc"))) + (substitute* "CMakeLists.txt" + ;; Sqlite + (("include\\(sqlite\\)") "") + (("\\$\\{sqlite_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "sqlite") + "/lib/libsqlite3.so")) + (("sqlite_copy_headers_to_destination") "") + + ;; PNG + (("include\\(png\\)") "") + (("\\$\\{png_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "libpng") + "/lib/libpng16.so")) + (("png_copy_headers_to_destination") "") + + ;; JPEG + (("include\\(jpeg\\)") "") + (("\\$\\{jpeg_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "libjpeg") + "/lib/libjpeg.so")) + (("jpeg_copy_headers_to_destination") "") + + ;; GIF + (("include\\(gif\\)") "") + (("\\$\\{gif_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "giflib") + "/lib/libgif.so")) + (("gif_copy_headers_to_destination") "") + + ;; lmdb + (("include\\(lmdb\\)") "") + (("\\$\\{lmdb_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "lmdb") + "/lib/liblmdb.so")) + (("lmdb_copy_headers_to_destination") "") + + ;; TODO: the "protobuf" project is depended on by other + ;; projects in the cmake files, so removing it is a little + ;; tricky. + ;;(("include\\(protobuf\\)") "") + ;; (("\\$\\{protobuf_STATIC_LIBRARIES\\}") + ;; (string-append (assoc-ref inputs "protobuf:static") + ;; "/lib/libprotobuf.a")) + ;;(("protobuf_copy_headers_to_destination") "") + ;;(("^ +protobuf$") "") + + ;; gRPC + ;; TODO: the gRPC sources are needed by protobuf + ;; (("include\\(grpc\\)") "") + ;; (("\\$\\{grpc_STATIC_LIBRARIES\\}") + ;; (string-append grpc "/lib/libaddress_sorting.a " + ;; grpc "/lib/libgpr.a " + ;; grpc "/lib/libgrpc++.a " + ;; grpc "/lib/libgrpc.a " + ;; grpc "/lib/libgrpc++_cronet.a " + ;; grpc "/lib/libgrpc_cronet.a " + ;; grpc "/lib/libgrpc++_error_details.a " + ;; grpc "/lib/libgrpc_plugin_support.a " + ;; grpc "/lib/libgrpcpp_channelz.a " + ;; grpc "/lib/libgrpc++_reflection.a " + ;; grpc "/lib/libgrpc++_unsecure.a " + ;; grpc "/lib/libgrpc_unsecure.a ")) + ;; (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES grpc\\)") "") + )) + + ;; ;; Remove dependency on bundled grpc + ;; (substitute* "tf_core_distributed_runtime.cmake" + ;; (("tf_core_cpu grpc") "tf_core_cpu")) + ;; (substitute* "tf_tools.cmake" + ;; (("add_dependencies\\(\\$\\{proto_text\\} grpc\\)") "")) + + (substitute* "external/grpc.cmake" + (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/grpc/src/grpc/third_party/cares/cares/lib/libcares.a") + (string-append (assoc-ref inputs "c-ares") + "/lib/libcares.so"))) + #t)) + (add-after 'configure 'unpack-third-party + (lambda* (#:key inputs #:allow-other-keys) + ;; This is needed to configure bundled packages properly. + (setenv "CONFIG_SHELL" (which "bash")) + (for-each + (lambda (name) + (let* ((what (assoc-ref inputs (string-append name "-src"))) + (name* (string-map (lambda (c) + (if (char=? c #\-) + #\_ c)) name)) + (where (string-append "../build/" name* "/src/" name*))) + (cond + ((string-suffix? ".zip" what) + (mkdir-p where) + (with-directory-excursion where + (invoke "unzip" what))) + ((string-suffix? ".tar.gz" what) + (mkdir-p where) + (invoke "tar" "xf" what + "-C" where "--strip-components=1")) + (else + ;; TODO: merge with "where" + (let ((parent (string-append "../build/" name* "/src/"))) + (mkdir-p parent) + (with-directory-excursion parent + (when (file-exists? name*) + (delete-file-recursively name*)) + (copy-recursively what name*) + (map make-file-writable + (find-files name* ".*")))))))) + (list "boringssl" + "cub" + "double-conversion" + "eigen" + "farmhash" + "fft2d" + "grpc" ; TODO: the sources need to be available for protobuf magic + "highwayhash" + "jsoncpp" + "nsync" + "protobuf" + "re2" + "snappy")) + + (rename-file "../build/cub/src/cub/cub-1.8.0/" + "../build/cub/src/cub/cub/") + + ;; gRPC dependencies: use installed packages instead of bundled + ;; sources. + (substitute* "../build/grpc/src/grpc/CMakeLists.txt" + (("set\\(gRPC_ZLIB_PROVIDER \"module\"") + "set(gRPC_ZLIB_PROVIDER \"package\"") + (("set\\(gRPC_CARES_PROVIDER \"module\"") + "set(gRPC_CARES_PROVIDER \"package\"") + (("set\\(gRPC_SSL_PROVIDER \"module\"") + "set(gRPC_SSL_PROVIDER \"package\"") + (("set\\(gRPC_PROTOBUF_PROVIDER \"module\"") + "set(gRPC_PROTOBUF_PROVIDER \"package\"")) + #t)) + (add-after 'unpack 'fix-python-build + (lambda* (#:key outputs #:allow-other-keys) + ;; Ensure that all Python dependencies can be found at build time. + (substitute* "tensorflow/contrib/cmake/tf_python.cmake" + (("PYTHONPATH=\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/tf_python" m) + (string-append m ":" (getenv "PYTHONPATH")))) + + ;; Correct the RUNPATH of ops libraries generated for Python. + ;; TODO: this doesn't work :( + ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: + ;; warning: RUNPATH contains bogus entries: ("/tmp/guix-build-tensorflow-1.9.0.drv-0/source/tensorflow/contrib/build") + ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: + ;; error: depends on 'libpywrap_tensorflow_internal.so', which + ;; cannot be found in RUNPATH ... + (substitute* "tensorflow/contrib/cmake/tf_cc_ops.cmake" + (("set_target_properties.*") + (string-append "set_target_properties(${_AT_TARGET} PROPERTIES \ +COMPILE_FLAGS ${target_compile_flags} \ +INSTALL_RPATH_USE_LINK_PATH TRUE \ +INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n"))) + #t)) + (add-after 'unpack 'find-eigen-headers + (lambda* (#:key inputs #:allow-other-keys) + ;; Ensure that Eigen headers can be found + (setenv "CPLUS_INCLUDE_PATH" + (string-append (getenv "CPLUS_INCLUDE_PATH") + ":" + (assoc-ref inputs "eigen") + "/include/eigen3")) + #t)) + (add-after 'build 'build-pip-package + (lambda* (#:key outputs #:allow-other-keys) + (setenv "LDFLAGS" + (string-append "-Wl,-rpath=" + (assoc-ref outputs "out") "/lib")) + (invoke "make" "tf_python_build_pip_package") + #t)) + (add-after 'build-pip-package 'install-python + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (wheel (car (find-files "../build/tf_python/dist/" "\\.whl$")))) + (invoke "python" "-m" "pip" "install" wheel + (string-append "--prefix=" out)) + + ;; XXX: broken RUNPATH, see fix-python-build phase. + (delete-file (string-append out "/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so")) + #t)))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("protobuf" ,protobuf-next) ; protoc + ;; The commit hashes and URLs for third-party source code are taken + ;; from "tensorflow/workspace.bzl". + ("boringssl-src" + ,(let ((commit "ee7aa02") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://boringssl.googlesource.com/boringssl") + (commit commit))) + (file-name (string-append "boringssl-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "1jf693q0nw0adsic6cgmbdx6g7wr4rj4vxa8j1hpn792fqhd8wgw"))))) + ("cub-src" + ,(let ((version "1.8.0")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/github.com/NVlabs/" + "cub/archive/" version ".zip")) + (file-name (string-append "cub-" version ".zip")) + (sha256 + (base32 + "1hsqikqridb90dkxkjr2918dcry6pfh46ccnwrzawl56aamhdykb"))))) + ("double-conversion-src" + ,(let ((commit "5664746") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/double-conversion.git") + (commit commit))) + (file-name (string-append "double-conversion-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "1h5lppqqxcvdg5jq42i5msgwx20ryij3apvmndflngrgdpc04gn1"))))) + ("eigen-src" + ,(let ((version "fd6845384b86")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/bitbucket.org/" + "eigen/eigen/get/" version ".tar.gz")) + (file-name (string-append "eigen-" version ".tar.gz")) + (sha256 + (base32 + "1aan4mvan8i5xsx4ivyqlg8ckbnnaqjw6i9ad8my992gg1fl2mnr"))))) + ("farmhash-src" + ,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45")) + (origin + (method url-fetch) + (uri (string-append + "https://mirror.bazel.build/github.com/google/farmhash/archive/" + commit ".tar.gz")) + (file-name (string-append "farmhash-0-" + (string-take commit 7) + ".tar.gz")) + (sha256 + (base32 + "185b2xdxl4d4cnsnv6abg8s22gxvx8673jq2yaq85bz4cdy58q35"))))) + ;; The license notice on the home page at + ;; http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html says: + ;; Copyright Takuya OOURA, 1996-2001 + ;; + ;; You may use, copy, modify and distribute this code for any purpose + ;; (include commercial use) and without fee. Please refer to this + ;; package when you modify this code. + ;; + ;; We take the identical tarball from the Bazel mirror, because the URL + ;; at the home page is not versioned and might change. + ("fft2d-src" + ,(origin + (method url-fetch) + (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz") + (file-name "fft2d.tar.gz") + (sha256 + (base32 + "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj")))) + ("grpc-src" + ,(let ((version "d184fa229d75d336aedea0041bd59cb93e7e267f")) + (origin + (method url-fetch) + (uri (string-append + "https://mirror.bazel.build/" + "github.com/grpc/grpc/archive/" + version".tar.gz")) + (file-name (string-append "grpc-" version ".tar.gz")) + (sha256 + (base32 + "0wsn0yvwnc08i9cq76083kgfv9k8q1wafnap6gvn32ki1qqk2nw9"))))) + ("highwayhash-src" + ,(let ((commit "be5edafc2e1a455768e260ccd68ae7317b6690ee") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/highwayhash.git") + (commit commit))) + (file-name (string-append "highwayhash-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "154jwf98cyy54hldr94pgjn85zynly3abpnc1avmb8a18lzwjyb6"))))) + ("jsoncpp-src" + ,(let ((commit "4356d9b") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/open-source-parsers/jsoncpp.git") + (commit commit))) + (file-name (string-append "jsoncpp-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "1anixxs5nwqknmcdxjd9zii5x0z7jx5qy011narjp2vxid59dzqa"))))) + ("nsync-src" + ,(let ((version "0559ce013feac8db639ee1bf776aca0325d28777") + (revision "1")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/nsync/archive/" + version ".tar.gz")) + (file-name (string-append "nsync-0." revision + "-" (string-take version 7) + ".tar.gz")) + (sha256 + (base32 + "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132"))))) + ("protobuf-src" + ,(let ((version "396336eb961b75f03b25824fe86cf6490fb75e3a")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/protobuf/archive/" + version ".tar.gz")) + (file-name (string-append "protobuf-" version ".tar.gz")) + (sha256 + (base32 + "1qsr5hgmmikshrg3035q6klbpv945lxfz0h8xhry4aj7rxx90vc4"))))) + ("re2-src" + ,(let ((commit "e7efc48") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/re2") + (commit commit))) + (file-name (string-append "re2-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "161g9841rjfsy5pn52fcis0s9hdr7rxvb06pad38j5rppfihvign"))))) + ("snappy-src" + ,(let ((version "1.1.7")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/snappy/archive/" + version ".tar.gz")) + (file-name (string-append "snappy-" version ".tar.gz")) + (sha256 + (base32 + "1m7rcdqzkys5lspj8jcsaah8w33zh28s771bw0ga2lgzfgl05yix"))))) + ("googletest" ,googletest) + ("swig" ,swig) + ("unzip" ,unzip))) + (propagated-inputs + `(("python-absl-py" ,python-absl-py) + ("python-astor" ,python-astor) + ("python-gast" ,python-gast) + ("python-grpcio" ,python-grpcio) + ("python-numpy" ,python-numpy) + ("python-protobuf" ,python-protobuf) + ("python-six" ,python-six) + ("python-termcolo" ,python-termcolor) + ("python-wheel" ,python-wheel))) + (inputs + `(("c-ares" ,c-ares-next) ; for grpc + ("eigen" ,eigen) + ("gemmlowp" ,gemmlowp-for-tensorflow) + ("lmdb" ,lmdb) + ("libjpeg" ,libjpeg) + ("libpng" ,libpng) + ("giflib" ,giflib) + ("sqlite" ,sqlite) + ("python" ,python-wrapper) + ("zlib" ,zlib))) + (home-page "https://tensorflow.org") + (synopsis "Machine learning framework") + (description + "TensorFlow is a software library for high performance numerical +computation. Its flexible architecture allows easy deployment of computation +across a variety of platforms, and from desktops to clusters of servers to +mobile and edge devices.") + (license license:asl2.0))) + (define-public dlib (package (name "dlib") -- 2.19.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH v2] gnu: Add tensorflow. 2019-01-02 16:16 [bug#33952] Add tensorflow Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus @ 2019-04-08 12:45 ` Ricardo Wurmus 2019-04-11 11:28 ` Ludovic Courtès 1 sibling, 1 reply; 18+ messages in thread From: Ricardo Wurmus @ 2019-04-08 12:45 UTC (permalink / raw) To: 33952; +Cc: Ricardo Wurmus * gnu/packages/machine-learning.scm (tensorflow): New variable. --- gnu/packages/machine-learning.scm | 451 ++++++++++++++++++++++++++++++ 1 file changed, 451 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 10aff22206..2ad3a39f19 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -49,6 +49,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cran) + #:use-module (gnu packages databases) #:use-module (gnu packages dejagnu) #:use-module (gnu packages gcc) #:use-module (gnu packages glib) @@ -65,7 +66,9 @@ #:use-module (gnu packages python) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages serialization) #:use-module (gnu packages statistics) + #:use-module (gnu packages sqlite) #:use-module (gnu packages swig) #:use-module (gnu packages tls) #:use-module (gnu packages web) @@ -1285,3 +1288,451 @@ for load balancing, tracing, health checking and authentication. It is also applicable in last mile of distributed computing to connect devices, mobile applications and browsers to backend services.") (license license:asl2.0))) + +;; Note that Tensorflow includes a "third_party" directory, which seems to not +;; only contain modified subsets of upstream library source code, but also +;; adapter headers provided by Google (such as the fft.h header, which is not +;; part of the upstream project code). The Tensorflow code includes headers +;; from the "third_party" directory. It does not look like we can replace +;; these headers with unmodified upstream files, so we keep them. +(define-public tensorflow + (package + (name "tensorflow") + (version "1.9.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tensorflow/tensorflow.git") + (commit (string-append "v" version)))) + (file-name (string-append "tensorflow-" version "-checkout")) + (sha256 + (base32 + "0a9kwha395g3wgxfwln5j8vn9nkspmd75xldrlqdq540w996g8xa")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; no "check" target + #:build-type "Release" + #:configure-flags + (let ((protobuf (assoc-ref %build-inputs "protobuf")) + (protobuf:native (assoc-ref %build-inputs "protobuf:native")) + (jsoncpp (assoc-ref %build-inputs "jsoncpp")) + (snappy (assoc-ref %build-inputs "snappy")) + (sqlite (assoc-ref %build-inputs "sqlite"))) + (list + ;; Use protobuf from Guix + (string-append "-Dprotobuf_STATIC_LIBRARIES=" + protobuf "/lib/libprotobuf.so") + (string-append "-DPROTOBUF_PROTOC_EXECUTABLE=" + protobuf:native "/bin/protoc") + + ;; Use snappy from Guix + (string-append "-Dsnappy_STATIC_LIBRARIES=" + snappy "/lib/libsnappy.so") + ;; Yes, this is not actually the include directory but a prefix... + (string-append "-Dsnappy_INCLUDE_DIR=" snappy) + + ;; Use jsoncpp from Guix + (string-append "-Djsoncpp_STATIC_LIBRARIES=" + jsoncpp "/lib/libjsoncpp.so") + ;; Yes, this is not actually the include directory but a prefix... + (string-append "-Djsoncpp_INCLUDE_DIR=" jsoncpp) + + ;; Use sqlite from Guix + (string-append "-Dsqlite_STATIC_LIBRARIES=" + sqlite "/lib/libsqlite.a") + + ;; Use system libraries wherever possible. Currently, this + ;; only affects zlib. + "-Dsystemlib_ALL=ON" + "-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON" + "-Dtensorflow_BUILD_SHARED_LIB=ON" + "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=OFF" + "-Dtensorflow_ENABLE_SSL_SUPPORT=OFF" + "-Dtensorflow_BUILD_CONTRIB_KERNELS=OFF")) + #:make-flags + (list "CC=gcc") + #:modules ((ice-9 ftw) + (guix build utils) + (guix build cmake-build-system)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'set-source-file-times-to-1980 + ;; At the end of the tf_python_build_pip_package target, a ZIP + ;; archive should be generated via bdist_wheel, but it fails with + ;; "ZIP does not support timestamps before 1980". Luckily, + ;; SOURCE_DATE_EPOCH is respected, which we set to some time in + ;; 1980. + (lambda _ (setenv "SOURCE_DATE_EPOCH" "315532800") #t)) + ;; See https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-406373913 + (add-after 'unpack 'python3.7-compatibility + (lambda _ + (substitute* '("tensorflow/python/eager/pywrap_tfe_src.cc" + "tensorflow/python/lib/core/ndarray_tensor.cc" + "tensorflow/python/lib/core/py_func.cc") + (("PyUnicode_AsUTF8") "(char *)PyUnicode_AsUTF8")) + (substitute* "tensorflow/c/eager/c_api.h" + (("unsigned char async") + "unsigned char is_async")) + + ;; Remove dependency on tensorboard, a complicated but probably + ;; optional package. + (substitute* "tensorflow/tools/pip_package/setup.py" + ((".*'tensorboard >.*") "")) + #t)) + (add-after 'python3.7-compatibility 'chdir + (lambda _ (chdir "tensorflow/contrib/cmake") #t)) + (add-after 'chdir 'disable-downloads + (lambda* (#:key inputs #:allow-other-keys) + (substitute* (find-files "external" "\\.cmake$") + (("GIT_REPOSITORY.*") "") + (("GIT_TAG.*") "") + (("PREFIX ") + "DOWNLOAD_COMMAND \"\"\nPREFIX ")) + + ;; Use packages from Guix + (let ((grpc (assoc-ref inputs "grpc"))) + (substitute* "CMakeLists.txt" + ;; Sqlite + (("include\\(sqlite\\)") "") + (("\\$\\{sqlite_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "sqlite") + "/lib/libsqlite3.so")) + (("sqlite_copy_headers_to_destination") "") + + ;; PNG + (("include\\(png\\)") "") + (("\\$\\{png_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "libpng") + "/lib/libpng16.so")) + (("png_copy_headers_to_destination") "") + + ;; JPEG + (("include\\(jpeg\\)") "") + (("\\$\\{jpeg_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "libjpeg") + "/lib/libjpeg.so")) + (("jpeg_copy_headers_to_destination") "") + + ;; GIF + (("include\\(gif\\)") "") + (("\\$\\{gif_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "giflib") + "/lib/libgif.so")) + (("gif_copy_headers_to_destination") "") + + ;; lmdb + (("include\\(lmdb\\)") "") + (("\\$\\{lmdb_STATIC_LIBRARIES\\}") + (string-append (assoc-ref inputs "lmdb") + "/lib/liblmdb.so")) + (("lmdb_copy_headers_to_destination") "") + + ;; Protobuf + (("include\\(protobuf\\)") "") + (("protobuf_copy_headers_to_destination") "") + (("^ +protobuf") "") + + ;; gRPC + (("include\\(grpc\\)") + "find_package(grpc REQUIRED NAMES gRPC)") + (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES grpc\\)") "") + + ;; Eigen + (("include\\(eigen\\)") + (string-append "find_package(eigen REQUIRED NAMES Eigen3) +set(eigen_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/external/eigen_archive " + (assoc-ref inputs "eigen") "/include/eigen3)")) + (("^ +eigen") "") + + ;; snappy + (("include\\(snappy\\)") + "add_definitions(-DTF_USE_SNAPPY)") + (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES snappy\\)") "") + + ;; jsoncpp + (("include\\(jsoncpp\\)") "") + (("^ +jsoncpp") "")) + + (substitute* "tf_core_framework.cmake" + ((" grpc") "") + (("\\$\\{GRPC_BUILD\\}/grpc_cpp_plugin") + (which "grpc_cpp_plugin")) + ;; Link with gRPC libraries + (("add_library\\(tf_protos_cc.*" m) + (string-append m + (format #f "\ntarget_link_libraries(tf_protos_cc PRIVATE \ +~a/lib/libgrpc++_unsecure.a \ +~a/lib/libgrpc_unsecure.a \ +~a/lib/libaddress_sorting.a \ +~a/lib/libgpr.a \ +~a//lib/libcares.so +)\n" + grpc grpc grpc grpc + (assoc-ref inputs "c-ares")))))) + (substitute* "tf_tools.cmake" + (("add_dependencies\\(\\$\\{proto_text.*") "")) + ;; Remove dependency on bundled grpc + (substitute* "tf_core_distributed_runtime.cmake" + (("tf_core_cpu grpc") "tf_core_cpu")) + + ;; This directory is a dependency of many targets. + (mkdir-p "protobuf") + #t)) + (add-after 'configure 'unpack-third-party-sources + (lambda* (#:key inputs #:allow-other-keys) + ;; This is needed to configure bundled packages properly. + (setenv "CONFIG_SHELL" (which "bash")) + (for-each + (lambda (name) + (let* ((what (assoc-ref inputs (string-append name "-src"))) + (name* (string-map (lambda (c) + (if (char=? c #\-) + #\_ c)) name)) + (where (string-append "../build/" name* "/src/" name*))) + (cond + ((string-suffix? ".zip" what) + (mkdir-p where) + (with-directory-excursion where + (invoke "unzip" what))) + ((string-suffix? ".tar.gz" what) + (mkdir-p where) + (invoke "tar" "xf" what + "-C" where "--strip-components=1")) + (else + (let ((parent (dirname where))) + (mkdir-p parent) + (with-directory-excursion parent + (when (file-exists? name*) + (delete-file-recursively name*)) + (copy-recursively what name*) + (map make-file-writable + (find-files name* ".*")))))))) + (list "boringssl" + "cub" + "double-conversion" + "farmhash" + "fft2d" + "highwayhash" + "nsync" + "re2")) + + (rename-file "../build/cub/src/cub/cub-1.8.0/" + "../build/cub/src/cub/cub/") + #t)) + (add-after 'unpack 'fix-python-build + (lambda* (#:key inputs outputs #:allow-other-keys) + (mkdir-p "protobuf-src") + (invoke "tar" "xf" (assoc-ref inputs "protobuf:src") + "-C" "protobuf-src" "--strip-components=1") + (mkdir-p "eigen-src") + (invoke "tar" "xf" (assoc-ref inputs "eigen:src") + "-C" "eigen-src" "--strip-components=1") + + (substitute* "tensorflow/contrib/cmake/tf_python.cmake" + ;; Ensure that all Python dependencies can be found at build time. + (("PYTHONPATH=\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/tf_python" m) + (string-append m ":" (getenv "PYTHONPATH"))) + ;; Take protobuf source files from our source package. + (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/protobuf/src/protobuf/src/google") + (string-append (getcwd) "/protobuf-src/src/google"))) + + (substitute* '("tensorflow/contrib/cmake/tf_shared_lib.cmake" + "tensorflow/contrib/cmake/tf_python.cmake") + ;; Take Eigen source files from our source package. + (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/eigen/src/eigen/") + (string-append (getcwd) "/eigen-src/")) + ;; Take Eigen headers from our own package. + (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/external/eigen_archive") + (string-append (assoc-ref inputs "eigen") "/include/eigen3"))) + + ;; Correct the RUNPATH of ops libraries generated for Python. + ;; TODO: this doesn't work :( + ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: + ;; warning: RUNPATH contains bogus entries: ("/tmp/guix-build-tensorflow-1.9.0.drv-0/source/tensorflow/contrib/build") + ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: + ;; error: depends on 'libpywrap_tensorflow_internal.so', which + ;; cannot be found in RUNPATH ... + (substitute* "tensorflow/contrib/cmake/tf_cc_ops.cmake" + (("set_target_properties.*") + (string-append "set_target_properties(${_AT_TARGET} PROPERTIES \ +COMPILE_FLAGS ${target_compile_flags} \ +INSTALL_RPATH_USE_LINK_PATH TRUE \ +INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n"))) + #t)) + (add-after 'build 'build-pip-package + (lambda* (#:key outputs #:allow-other-keys) + (setenv "LDFLAGS" + (string-append "-Wl,-rpath=" + (assoc-ref outputs "out") "/lib")) + (invoke "make" "tf_python_build_pip_package") + #t)) + (add-after 'build-pip-package 'install-python + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (wheel (car (find-files "../build/tf_python/dist/" "\\.whl$")))) + (invoke "python" "-m" "pip" "install" wheel + (string-append "--prefix=" out)) + + ;; XXX: broken RUNPATH, see fix-python-build phase. + (delete-file + (string-append + out "/lib/python3.7/site-packages/tensorflow/contrib/" + "seq2seq/python/ops/lib_beam_search_ops.so")) + #t)))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("protobuf:native" ,protobuf-next) ; protoc + ("protobuf:src" ,(package-source protobuf-next)) + ("eigen:src" ,(package-source eigen-for-tensorflow)) + ;; The commit hashes and URLs for third-party source code are taken + ;; from "tensorflow/workspace.bzl". + ("boringssl-src" + ,(let ((commit "ee7aa02") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://boringssl.googlesource.com/boringssl") + (commit commit))) + (file-name (string-append "boringssl-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "1jf693q0nw0adsic6cgmbdx6g7wr4rj4vxa8j1hpn792fqhd8wgw"))))) + ("cub-src" + ,(let ((version "1.8.0")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/github.com/NVlabs/" + "cub/archive/" version ".zip")) + (file-name (string-append "cub-" version ".zip")) + (sha256 + (base32 + "1hsqikqridb90dkxkjr2918dcry6pfh46ccnwrzawl56aamhdykb"))))) + ("double-conversion-src" + ,(let ((commit "5664746") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/double-conversion.git") + (commit commit))) + (file-name + (git-file-name "double-conversion" + (string-append "0-" revision "." + (string-take commit 7)))) + (sha256 + (base32 + "1h5lppqqxcvdg5jq42i5msgwx20ryij3apvmndflngrgdpc04gn1"))))) + ("farmhash-src" + ,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45")) + (origin + (method url-fetch) + (uri (string-append + "https://mirror.bazel.build/github.com/google/farmhash/archive/" + commit ".tar.gz")) + (file-name (string-append "farmhash-0-" (string-take commit 7) + ".tar.gz")) + (sha256 + (base32 + "185b2xdxl4d4cnsnv6abg8s22gxvx8673jq2yaq85bz4cdy58q35"))))) + ;; The license notice on the home page at + ;; http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html says: + ;; Copyright Takuya OOURA, 1996-2001 + ;; + ;; You may use, copy, modify and distribute this code for any purpose + ;; (include commercial use) and without fee. Please refer to this + ;; package when you modify this code. + ;; + ;; We take the identical tarball from the Bazel mirror, because the URL + ;; at the home page is not versioned and might change. + ("fft2d-src" + ,(origin + (method url-fetch) + (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz") + (file-name "fft2d.tar.gz") + (sha256 + (base32 + "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj")))) + ("highwayhash-src" + ,(let ((commit "be5edafc2e1a455768e260ccd68ae7317b6690ee") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/highwayhash.git") + (commit commit))) + (file-name (string-append "highwayhash-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "154jwf98cyy54hldr94pgjn85zynly3abpnc1avmb8a18lzwjyb6"))))) + ("nsync-src" + ,(let ((version "0559ce013feac8db639ee1bf776aca0325d28777") + (revision "1")) + (origin + (method url-fetch) + (uri (string-append "https://mirror.bazel.build/" + "github.com/google/nsync/archive/" + version ".tar.gz")) + (file-name (string-append "nsync-0." revision + "-" (string-take version 7) + ".tar.gz")) + (sha256 + (base32 + "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132"))))) + ("re2-src" + ,(let ((commit "e7efc48") + (revision "1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/re2") + (commit commit))) + (file-name (string-append "re2-0-" revision + (string-take commit 7) + "-checkout")) + (sha256 + (base32 + "161g9841rjfsy5pn52fcis0s9hdr7rxvb06pad38j5rppfihvign"))))) + ("googletest" ,googletest) + ("swig" ,swig) + ("unzip" ,unzip))) + (propagated-inputs + `(("python-absl-py" ,python-absl-py) + ("python-astor" ,python-astor) + ("python-gast" ,python-gast) + ("python-grpcio" ,python-grpcio) + ("python-numpy" ,python-numpy) + ("python-protobuf" ,python-protobuf-next) + ("python-six" ,python-six) + ("python-termcolo" ,python-termcolor) + ("python-wheel" ,python-wheel))) + (inputs + `(("c-ares" ,c-ares-next) + ("eigen" ,eigen-for-tensorflow) + ("gemmlowp" ,gemmlowp-for-tensorflow) + ("lmdb" ,lmdb) + ("libjpeg" ,libjpeg) + ("libpng" ,libpng) + ("giflib" ,giflib) + ("grpc" ,grpc) + ("jsoncpp" ,jsoncpp-for-tensorflow) + ("snappy" ,snappy) + ("sqlite" ,sqlite) + ("protobuf" ,protobuf-next) + ("python" ,python-wrapper) + ("zlib" ,zlib))) + (home-page "https://tensorflow.org") + (synopsis "Machine learning framework") + (description + "TensorFlow is a flexible platform for building and training machine +learning models. It provides a library for high performance numerical +computation and includes high level Python APIs, including both a sequential +API for beginners that allows users to build models quickly by plugging +together building blocks and a subclassing API with an imperative style for +advanced research.") + (license license:asl2.0))) -- 2.21.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [bug#33952] [PATCH v2] gnu: Add tensorflow. 2019-04-08 12:45 ` [bug#33952] [PATCH v2] " Ricardo Wurmus @ 2019-04-11 11:28 ` Ludovic Courtès 2019-04-11 15:55 ` bug#33952: " Ricardo Wurmus 0 siblings, 1 reply; 18+ messages in thread From: Ludovic Courtès @ 2019-04-11 11:28 UTC (permalink / raw) To: Ricardo Wurmus; +Cc: 33952 Hello Ricardo, Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis: > * gnu/packages/machine-learning.scm (tensorflow): New variable. Go for it! Congrats on this one, and a big thanks. We can all guess how much sweat went into this package! Ludo’. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#33952: [PATCH v2] gnu: Add tensorflow. 2019-04-11 11:28 ` Ludovic Courtès @ 2019-04-11 15:55 ` Ricardo Wurmus 0 siblings, 0 replies; 18+ messages in thread From: Ricardo Wurmus @ 2019-04-11 15:55 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 33952-done Ludovic Courtès <ludo@gnu.org> writes: >> * gnu/packages/machine-learning.scm (tensorflow): New variable. > > Go for it! > > Congrats on this one, and a big thanks. We can all guess how much sweat > went into this package! Thanks for the review! I pushed it to the master branch with commit 4fa16c9ae639c9891359527edc8c0b235e3987f2. -- Ricardo ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2019-04-11 15:56 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-01-02 16:16 [bug#33952] Add tensorflow Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 01/14] gnu: Add gemmlowp-for-tensorflow Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 02/14] gnu: Add tensorflow-core Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 03/14] gnu: Add c-ares-next Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 04/14] gnu: Add protobuf-next Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 05/14] gnu: Add grpc Ricardo Wurmus 2019-01-02 16:17 ` [bug#33952] [PATCH 06/14] gnu: Add graphviz-2.38 Ricardo Wurmus 2019-01-02 16:18 ` [bug#33952] [PATCH 07/14] gnu: Add python-doctest-ignore-unicode Ricardo Wurmus 2019-01-02 16:18 ` [bug#33952] [PATCH 08/14] gnu: Add python-graphviz Ricardo Wurmus 2019-01-02 16:18 ` [bug#33952] [PATCH 09/14] gnu: Add python-absl-py Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 10/14] gnu: Add python-astor Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 11/14] gnu: Add python-astunparse Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 12/14] gnu: Add python-gast Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 13/14] gnu: Add python-grpcio Ricardo Wurmus 2019-01-02 16:25 ` [bug#33952] [PATCH 14/14] gnu: Add tensorflow Ricardo Wurmus 2019-04-08 12:45 ` [bug#33952] [PATCH v2] " Ricardo Wurmus 2019-04-11 11:28 ` Ludovic Courtès 2019-04-11 15:55 ` bug#33952: " Ricardo Wurmus
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.