Merge branch 'staging-next' into staging

This commit is contained in:
Jan Tojnar
2020-03-31 21:33:00 +02:00
297 changed files with 9130 additions and 2432 deletions

View File

@@ -1,21 +1,26 @@
{ lib, buildPythonPackage, fetchdarcs, zope_interface, isPy3k }:
{ lib, buildPythonPackage, fetchFromGitHub, zope_interface, isPy3k }:
buildPythonPackage rec {
pname = "python-application";
version = "2.7.0";
version = "2.8.0";
disabled = isPy3k;
src = fetchdarcs {
url = "http://devel.ag-projects.com/repositories/${pname}";
src = fetchFromGitHub {
owner = "AGProjects";
repo = pname;
rev = "release-${version}";
sha256 = "1xpyk2v3naxkjhpyris58dxg1lxbraxgjd6f7w1sah5j0sk7psla";
sha256 = "1xd2gbpmx2ghap9cnr1h6sxjai9419bdp3y9qp5lh67977m0qg30";
};
buildInputs = [ zope_interface ];
# No tests upstream to run
doCheck = false;
meta = with lib; {
description = "Basic building blocks for python applications";
homepage = https://github.com/AGProjects/python-application;
homepage = "https://github.com/AGProjects/python-application";
changelog = "https://github.com/AGProjects/python-application/blob/master/ChangeLog";
license = licenses.lgpl2Plus;
};
}

View File

@@ -1,7 +1,7 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, pep8, nose }:
buildPythonPackage rec {
version = "0.6";
version = "0.8";
pname = "cgroup-utils";
buildInputs = [ pep8 nose ];
@@ -16,7 +16,7 @@ buildPythonPackage rec {
owner = "peo3";
repo = "cgroup-utils";
rev = "v${version}";
sha256 = "1ck0aijzrg9xf6hjdxnynkapnyxw0y385jb0q7wyq4jf77ayfszc";
sha256 = "0qnbn8cnq8m14s8s1hcv25xjd55dyb6yy54l5vc7sby5xzzp11fq";
};
meta = with stdenv.lib; {

View File

@@ -79,7 +79,7 @@ buildPythonPackage rec {
meta = with lib; {
description = "A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.";
homepage = "http://github.com/quantumlib/cirq";
homepage = "https://github.com/quantumlib/cirq";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};

View File

@@ -2,13 +2,13 @@
buildPythonPackage rec {
pname = "cocotb";
version = "1.3.0";
version = "1.3.1";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
sha256 = "0gwd79zm7196fhnbzbdpyvgzsfjfzl3pmc5hh27h7hckfpxzj9yw";
sha256 = "118wp5sjsl99hj8pqw5n3v2lry9r949p2hv4l92p086q1n0axxk3";
};
propagatedBuildInputs = [
@@ -26,7 +26,7 @@ buildPythonPackage rec {
substituteInPlace $f --replace 'shell which' 'shell command -v'
done
# This can probably be removed in the next update after 1.3.0
# This can probably be removed in the next update after 1.3.1
substituteInPlace cocotb/share/makefiles/Makefile.inc --replace "-Werror" ""
'';

View File

@@ -4,11 +4,11 @@
buildPythonPackage rec {
pname = "datadog";
version = "0.34.1";
version = "0.35.0";
src = fetchPypi {
inherit pname version;
sha256 = "1msi3wm0khmzh0ad7lwd5gigmqrxj25hd4w0qrsarihmd4ywrn1v";
sha256 = "0qpy6mg9gfjxvjms0aaglzayhmdds4agv0lh05g2mkfw620nm8zl";
};
postPatch = ''

View File

@@ -0,0 +1,39 @@
{ stdenv
, buildPythonPackage
, fetchFromGitHub
, pythonAtLeast
, nose
, nibabel
, pydicom
}:
buildPythonPackage rec {
pname = "dcmstack";
version = "0.8";
disabled = pythonAtLeast "3.8";
# https://github.com/moloney/dcmstack/issues/67
src = fetchFromGitHub {
owner = "moloney";
repo = pname;
rev = "v${version}";
sha256 = "1n24pp3rqz7ss1z6276fxynnppraxadbl3b9p8ijrcqnpzbzih7p";
};
propagatedBuildInputs = [ nibabel pydicom ];
checkInputs = [ nose ];
checkPhase = ''
runHook preCheck
nosetests
runHook postCheck
'';
meta = with stdenv.lib; {
homepage = "https://github.com/moloney/dcmstack";
description = "DICOM to Nifti conversion preserving metadata";
license = licenses.mit;
maintainers = with maintainers; [ bcdarwin ];
};
}

View File

@@ -10,18 +10,18 @@
buildPythonPackage rec {
pname = "Flask-Babel";
version = "0.12.2";
version = "1.0.0";
src = fetchPypi {
inherit pname version;
sha256 = "316ad183e42003f3922957fa643d0a1e8e34a0f0301a88c3a8f605bc37ba5c86";
sha256 = "0gmb165vkwv5v7dxsxa2i3zhafns0fh938m2zdcrv4d8z5l099yn";
};
propagatedBuildInputs = [ flask jinja2 speaklater Babel pytz ];
meta = with stdenv.lib; {
description = "Adds i18n/l10n support to Flask applications";
homepage = https://github.com/mitsuhiko/flask-babel;
homepage = "https://github.com/mitsuhiko/flask-babel";
license = licenses.bsd0;
maintainers = with maintainers; [ matejc ];
};

View File

@@ -12,11 +12,11 @@
buildPythonPackage rec {
pname = "hdbscan";
version = "0.8.24";
version = "0.8.25";
src = fetchPypi {
inherit pname version;
sha256 = "fe31a7ea0ce2c9babd190a195e491834ff9f64c74daa4ca94fa65a88f701269a";
sha256 = "17mi4nlifaygfw3n5ark5mfzx71pjxz3h6l455sh0i5mzh6czk4j";
};
checkInputs = [ nose ];

View File

@@ -2,11 +2,11 @@
buildPythonPackage rec {
pname = "identify";
version = "1.4.11";
version = "1.4.13";
src = fetchPypi {
inherit pname version;
sha256 = "15kbcgqz6zf9qqvyw3pwy611knv1lyaqmc213ivmqciq3zifn96q";
sha256 = "12adarxndb9f5kgbfch9644h86jhbf6vc1d5c5iiqnjqws9n495b";
};
# Tests not included in PyPI tarball

View File

@@ -7,12 +7,12 @@
buildPythonPackage rec {
pname = "ipdb";
version = "0.13.0";
version = "0.13.2";
disabled = isPyPy; # setupterm: could not find terminfo database
src = fetchPypi {
inherit pname version;
sha256 = "0nbs9m2pqg4j10m7c31vyb8h7wy29d9s8kiv0k2igbr821k1y3xr";
sha256 = "0jcd849rx30y3wcgzsqbn06v0yjlzvb9x3076q0yxpycdwm1ryvp";
};
propagatedBuildInputs = [ ipython ];

View File

@@ -7,11 +7,11 @@
buildPythonPackage rec {
pname = "jupytext";
version = "1.3.4";
version = "1.4.1";
src = fetchPypi {
inherit pname version;
sha256 = "0jijf4a3iaskzi6frjwhd8drh7brn94r1zl7gni6d0dzr296mm93";
sha256 = "126lmz702hbk7gyr4i6gkicmycx7zgsgjf47a6izq2d17bs0a9ji";
};
propagatedBuildInputs = [

View File

@@ -0,0 +1,27 @@
{ stdenv, buildPythonPackage, fetchgit, pkgconfig, lxml, libvirt, nose }:
buildPythonPackage rec {
pname = "libvirt";
version = "5.9.0";
src = fetchgit {
url = git://libvirt.org/libvirt-python.git;
rev = "v${version}";
sha256 = "0qvr0s7yasswy1s5cvkm91iifk33pb8s7nbb38zznc46706b358r";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libvirt lxml ];
checkInputs = [ nose ];
checkPhase = ''
nosetests
'';
meta = with stdenv.lib; {
homepage = http://www.libvirt.org/;
description = "libvirt Python bindings";
license = licenses.lgpl2;
maintainers = [ maintainers.fpletz ];
};
}

View File

@@ -2,12 +2,12 @@
buildPythonPackage rec {
pname = "libvirt";
version = "5.4.0";
version = "6.1.0";
src = assert version == libvirt.version; fetchgit {
url = git://libvirt.org/libvirt-python.git;
rev = "v${version}";
sha256 = "0ja35z90i3m7vsjfpzfm7awkmja3h0150376i5pzmf2q8vp61fi5";
sha256 = "0h3w1p5y4kg2hdbhxmg4lphcnmr7979iwi0m750f8vzbfccsrp7k";
};
nativeBuildInputs = [ pkgconfig ];

View File

@@ -45,7 +45,7 @@ buildPythonPackage rec {
meta = with stdenv.lib; {
description = "Video editing with Python";
homepage = http://zulko.github.io/moviepy/;
homepage = "https://zulko.github.io/moviepy/";
license = licenses.mit;
};

View File

@@ -24,12 +24,12 @@
buildPythonPackage rec {
pname = "nbdime";
version = "1.1.0";
version = "2.0.0";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "0qfy7nmlg75vryvrlgd6p0rqrvcclq8n9kd0n4xv5959s9sjy0w0";
sha256 = "0pbi22mc5al29pvsw7bhai2d58i8n77gv09r7avr1wap6ni7jvw9";
};
checkInputs = [
@@ -61,7 +61,7 @@ buildPythonPackage rec {
];
meta = with lib; {
homepage = https://github.com/jupyter/nbdime;
homepage = "https://github.com/jupyter/nbdime";
description = "Tools for diffing and merging of Jupyter notebooks.";
license = licenses.bsd3;
maintainers = with maintainers; [ tbenst ];

View File

@@ -0,0 +1,36 @@
{ buildPythonPackage
, fetchPypi
, lib
, click
, requests
, packaging
}:
with lib;
buildPythonPackage rec {
pname = "openwrt-luci-rpc";
version = "1.1.2";
srcs = fetchPypi {
inherit pname version;
sha256 = "144bw7w1xvpdkad5phflpkl15ih5pvi19799wmvfv8mj1dn1yjhp";
};
postPatch = ''
substituteInPlace setup.py --replace "requests==2.21.0" "requests"
substituteInPlace setup.py --replace "packaging==19.1" "packaging"
'';
propagatedBuildInputs = [ click requests packaging ];
meta = {
description = ''
Python3 module for interacting with the OpenWrt Luci RPC interface.
Supports 15.X & 17.X & 18.X or newer releases of OpenWrt.
'';
homepage = "https://github.com/fbradyirl/openwrt-luci-rpc";
license = licenses.asl20;
maintainers = with maintainers; [ matt-snider ];
};
}

View File

@@ -2,11 +2,11 @@
buildPythonPackage rec {
pname = "phonenumbers";
version = "8.11.4";
version = "8.12.0";
src = fetchPypi {
inherit pname version;
sha256 = "13hfcw89kppm8s2qx0s5bafzxjc0qhm9sxmpf6yqvshz2fn82pk8";
sha256 = "0mnicas0c5av322d7k6m14j3c10axh9mcvn3vx99vhngdnb9j6hn";
};
meta = {

View File

@@ -1,4 +1,4 @@
{ lib, buildPythonPackage, python, isPy3k, arrow-cpp, cmake, cython, futures, hypothesis, numpy, pandas, pytest, pytest-lazy-fixture, pkgconfig, setuptools_scm, six }:
{ lib, fetchpatch, buildPythonPackage, python, isPy3k, arrow-cpp, cmake, cython, futures, hypothesis, numpy, pandas, pytestCheckHook, pytest-lazy-fixture, pkgconfig, setuptools_scm, six }:
let
_arrow-cpp = arrow-cpp.override { inherit python; };
@@ -9,11 +9,21 @@ buildPythonPackage rec {
inherit (_arrow-cpp) version src;
patches = [
# Remove when updating pkgs.arrow-cpp to 0.17
(fetchpatch {
name = "ARROW-8106-fix-conversion-test";
url = "https://github.com/apache/arrow/commit/af20bbff30adc560d7e57dd921345d00cc8b870c.patch";
sha256 = "0ihpw589vh35va31ajzy5zpx3bqd9gdn3342rghi03r245kch9zd";
stripLen = 1;
})
];
sourceRoot = "apache-arrow-${version}/python";
nativeBuildInputs = [ cmake cython pkgconfig setuptools_scm ];
propagatedBuildInputs = [ numpy six ] ++ lib.optionals (!isPy3k) [ futures ];
checkInputs = [ hypothesis pandas pytest pytest-lazy-fixture ];
checkInputs = [ hypothesis pandas pytestCheckHook pytest-lazy-fixture ];
PYARROW_BUILD_TYPE = "release";
PYARROW_WITH_PARQUET = true;
@@ -24,6 +34,8 @@ buildPythonPackage rec {
# ourselves
"-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
];
ARROW_HOME = _arrow-cpp;
PARQUET_HOME = _arrow-cpp;
dontUseCmakeConfigure = true;
@@ -31,40 +43,12 @@ buildPythonPackage rec {
export PYARROW_PARALLEL=$NIX_BUILD_CORES
'';
dontUseSetuptoolsCheck = true;
preCheck = ''
rm pyarrow/tests/test_jvm.py
rm pyarrow/tests/test_hdfs.py
rm pyarrow/tests/test_cuda.py
# fails: "ArrowNotImplementedError: Unsupported numpy type 22"
substituteInPlace pyarrow/tests/test_feather.py --replace "test_timedelta_with_nulls" "_disabled"
# runs out of memory on @grahamcofborg linux box
substituteInPlace pyarrow/tests/test_feather.py --replace "test_large_dataframe" "_disabled"
# probably broken on python2
substituteInPlace pyarrow/tests/test_feather.py --replace "test_unicode_filename" "_disabled"
# fails "error: [Errno 2] No such file or directory: 'test'" because
# nix_run_setup invocation somehow manages to import deserialize_buffer.py
# when it is not intended to be imported at all
rm pyarrow/tests/deserialize_buffer.py
substituteInPlace pyarrow/tests/test_feather.py --replace "test_deserialize_buffer_in_different_process" "_disabled"
# Fails to bind a socket
# "PermissionError: [Errno 1] Operation not permitted"
substituteInPlace pyarrow/tests/test_ipc.py --replace "test_socket_" "_disabled"
'';
ARROW_HOME = _arrow-cpp;
PARQUET_HOME = _arrow-cpp;
checkPhase = ''
mv pyarrow/tests tests
rm -rf pyarrow
mkdir pyarrow
mv tests pyarrow/tests
pytest -v
'';
meta = with lib; {

View File

@@ -3,13 +3,13 @@
, setuptools }:
buildPythonPackage rec {
version = "1.0.18";
version = "1.0.19";
pname = "pysmbc";
src = fetchPypi {
inherit pname version;
extension = "tar.bz2";
sha256 = "5da8aef1e3edaaffb1fbe2afe3772ba0a5f5bf666a28ae5db7b59ef96e465bdf";
sha256 = "0dwffbfp3ay8y35hhc37ip61xdh522f5rfs097f3ia121h9x1mvj";
};
nativeBuildInputs = [ pkgconfig ];
@@ -17,7 +17,7 @@ buildPythonPackage rec {
meta = with stdenv.lib; {
description = "libsmbclient binding for Python";
homepage = https://github.com/hamano/pysmbc;
homepage = "https://github.com/hamano/pysmbc";
license = licenses.gpl2Plus;
};
}

View File

@@ -24,10 +24,13 @@ buildPythonPackage rec {
meta = with stdenv.lib; {
description = "A pure python implementation of OTR";
homepage = https://github.com/AGProjects/otr;
homepage = "https://github.com/AGProjects/python-otr";
license = licenses.lgpl21Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ edwtjo ];
# The package itself does not support python3, and its transitive
# dependencies rely on namespace package support that does not work in
# Nix's python2 infra. See #74619 for details.
broken = true;
};
}

View File

@@ -0,0 +1,26 @@
{ stdenv, fetchFromGitHub, buildPythonPackage, requests, pytest, flask, isPy27
}:
buildPythonPackage rec {
version = "4.1";
pname = "roku";
disabled = isPy27;
src = fetchFromGitHub {
owner = "jcarbaugh";
repo = "python-roku";
rev = "v${version}";
sha256 = "09mq59kjll7gj1srw4qc921ncsm7cld95sbz5v3p2bwmgckpqza7";
};
propagatedBuildInputs = [ requests ];
checkInputs = [ pytest flask ];
pythonImportsCheck = [ "roku" ];
meta = with stdenv.lib; {
description = "Screw remotes. Control your Roku with Python.";
homepage = "https://github.com/jcarbaugh/python-roku";
license = licenses.bsd3;
};
}

View File

@@ -5,11 +5,11 @@
buildPythonPackage rec {
pname = "Shapely";
version = "1.6.4.post2";
version = "1.7.0";
src = fetchPypi {
inherit pname version;
sha256 = "c4b87bb61fc3de59fc1f85e71a79b0c709dc68364d9584473697aad4aa13240f";
sha256 = "07lmrihj6pa7f99m97hbf2anqlhhwippcdz03bqkyihnlkhry6p2";
};
nativeBuildInputs = [

View File

@@ -1,9 +1,9 @@
diff --git a/shapely/geos.py b/shapely/geos.py
index 09bf1ab..837aa98 100644
index d5a67d2..19b7ffc 100644
--- a/shapely/geos.py
+++ b/shapely/geos.py
@@ -55,100 +55,10 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
"Could not find lib {0} or load any of its variants {1}.".format(
@@ -61,123 +61,11 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
"Could not find lib {} or load any of its variants {}.".format(
libname, fallbacks or []))
-_lgeos = None
@@ -16,15 +16,25 @@ index 09bf1ab..837aa98 100644
- if len(geos_whl_so) == 1:
- _lgeos = CDLL(geos_whl_so[0])
- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
- elif hasattr(sys, 'frozen'):
- geos_pyinstaller_so = glob.glob(os.path.join(sys.prefix, 'libgeos_c-*.so.*'))
- if len(geos_pyinstaller_so) == 1:
- _lgeos = CDLL(geos_pyinstaller_so[0])
- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
- elif os.getenv('CONDA_PREFIX', ''):
- # conda package.
- _lgeos = CDLL(os.path.join(sys.prefix, 'lib', 'libgeos_c.so'))
- else:
- alt_paths = [
- 'libgeos_c.so.1',
- 'libgeos_c.so',
- # anaconda
- os.path.join(sys.prefix, "lib", "libgeos_c.so"),
- ]
- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
- free = load_dll('c').free
- # Necessary for environments with only libc.musl
- c_alt_paths = [
- 'libc.musl-x86_64.so.1'
- ]
- free = load_dll('c', fallbacks=c_alt_paths).free
- free.argtypes = [c_void_p]
- free.restype = None
-
@@ -32,10 +42,19 @@ index 09bf1ab..837aa98 100644
- # Test to see if we have a delocated wheel with a GEOS dylib.
- geos_whl_dylib = os.path.abspath(os.path.join(os.path.dirname(
- __file__), '.dylibs/libgeos_c.1.dylib'))
- if os.path.exists(geos_whl_dylib):
- _lgeos = CDLL(geos_whl_dylib)
- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
-
- if os.path.exists(geos_whl_dylib):
- handle = CDLL(None)
- if hasattr(handle, "initGEOS_r"):
- LOG.debug("GEOS already loaded")
- _lgeos = handle
- else:
- _lgeos = CDLL(geos_whl_dylib)
- LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
-
- elif os.getenv('CONDA_PREFIX', ''):
- # conda package.
- _lgeos = CDLL(os.path.join(sys.prefix, 'lib', 'libgeos_c.dylib'))
- else:
- if hasattr(sys, 'frozen'):
- try:
@@ -52,12 +71,12 @@ index 09bf1ab..837aa98 100644
- os.path.join(sys._MEIPASS, 'libgeos_c.1.dylib'))
- else:
- alt_paths = [
- # anaconda
- os.path.join(sys.prefix, "lib", "libgeos_c.dylib"),
- # The Framework build from Kyng Chaos
- "/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",
- # macports
- '/opt/local/lib/libgeos_c.dylib',
- # homebrew
- '/usr/local/lib/libgeos_c.dylib',
- ]
- _lgeos = load_dll('geos_c', fallbacks=alt_paths)
-
@@ -66,30 +85,34 @@ index 09bf1ab..837aa98 100644
- free.restype = None
-
-elif sys.platform == 'win32':
- try:
- egg_dlls = os.path.abspath(
- os.path.join(os.path.dirname(__file__), 'DLLs'))
- if hasattr(sys, "frozen"):
- wininst_dlls = os.path.normpath(
- os.path.abspath(sys.executable + '../../DLLS'))
- else:
- wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
- original_path = os.environ['PATH']
- os.environ['PATH'] = "%s;%s;%s" % \
- (egg_dlls, wininst_dlls, original_path)
- _lgeos = load_dll("geos_c.dll", fallbacks=[
- os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
- ])
- except (ImportError, WindowsError, OSError):
- raise
-
- def free(m):
- if os.getenv('CONDA_PREFIX', ''):
- # conda package.
- _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
- else:
- try:
- cdll.msvcrt.free(m)
- except WindowsError:
- # XXX: See http://trac.gispython.org/projects/PCL/ticket/149
- pass
- egg_dlls = os.path.abspath(
- os.path.join(os.path.dirname(__file__), 'DLLs'))
- if hasattr(sys, '_MEIPASS'):
- wininst_dlls = sys._MEIPASS
- elif hasattr(sys, "frozen"):
- wininst_dlls = os.path.normpath(
- os.path.abspath(sys.executable + '../../DLLS'))
- else:
- wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
- original_path = os.environ['PATH']
- os.environ['PATH'] = "%s;%s;%s" % \
- (egg_dlls, wininst_dlls, original_path)
- _lgeos = load_dll("geos_c.dll")
- except (ImportError, WindowsError, OSError):
- raise
-
- def free(m):
- try:
- cdll.msvcrt.free(m)
- except WindowsError:
- # XXX: See http://trac.gispython.org/projects/PCL/ticket/149
- pass
-elif sys.platform == 'sunos5':
- _lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
- free = CDLL('libc.so.1').free

View File

@@ -1,22 +1,33 @@
{ buildPythonPackage
, pkgs
, testtools
# pkgs dependencies
, check
, cppunit
, pkg-config
, subunit
# python dependencies
, fixtures
, hypothesis
, pytest
, testscenarios
, testtools
}:
buildPythonPackage {
name = pkgs.subunit.name;
src = pkgs.subunit.src;
inherit (subunit) name src meta;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ check cppunit ];
propagatedBuildInputs = [ testtools ];
checkInputs = [ testscenarios ];
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = [ pkgs.check pkgs.cppunit ];
patchPhase = ''
sed -i 's/version=VERSION/version="${pkgs.subunit.version}"/' setup.py
checkInputs = [ testscenarios hypothesis fixtures pytest ];
# ignore tests which call shell code, or call methods which haven't been implemented
checkPhase = ''
pytest python/subunit \
--ignore=python/subunit/tests/test_{output_filter,test_protocol{,2}}.py
'';
meta = pkgs.subunit.meta;
patchPhase = ''
sed -i 's/version=VERSION/version="${subunit.version}"/' setup.py
'';
}

View File

@@ -6,6 +6,9 @@
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.
version = "1.15.1";
format = "wheel";

View File

@@ -42,7 +42,7 @@ let
bazelTarget = ":pip_pkg";
fetchAttrs = {
sha256 = "0135nxxvkmjzpd80r1g9fdkk9h62g0xlvp32g5zgk0hkma5kq0bx";
sha256 = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
};
buildAttrs = {

View File

@@ -0,0 +1,66 @@
{ lib, fetchPypi, buildPythonPackage, isPy3k
, numpy
, wheel
, werkzeug
, protobuf
, grpcio
, markdown
, futures
, absl-py
}:
# tensorflow/tensorboard is built from a downloaded wheel, because
# https://github.com/tensorflow/tensorboard/issues/719 blocks
# buildBazelPackage.
buildPythonPackage rec {
pname = "tensorflow-tensorboard";
version = "1.15.0";
format = "wheel";
src = fetchPypi ({
pname = "tensorboard";
inherit version;
format = "wheel";
} // (if isPy3k then {
python = "py3";
sha256 = "1g62i3nrgp8q9wfsyqqjkkfnsz7x2k018c26kdh527h1yrjjrbac";
} else {
python = "py2";
sha256 = "0l3zc8j2sh7h1z4qpy8kfvclv3kzndri55p10i42q6xahs9phav1";
}));
propagatedBuildInputs = [
numpy
werkzeug
protobuf
markdown
grpcio
absl-py
# not declared in install_requires, but used at runtime
# https://github.com/NixOS/nixpkgs/issues/73840
wheel
] ++ lib.optional (!isPy3k) futures;
# in the absence of a real test suite, run cli and imports
checkPhase = ''
$out/bin/tensorboard --help > /dev/null
'';
pythonImportsCheck = [
"tensorboard"
"tensorboard.backend"
"tensorboard.compat"
"tensorboard.data"
"tensorboard.plugins"
"tensorboard.summary"
"tensorboard.util"
];
meta = with lib; {
description = "TensorFlow's Visualization Toolkit";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ abbradar ];
};
}

View File

@@ -0,0 +1,121 @@
{ stdenv
, lib
, fetchurl
, buildPythonPackage
, isPy3k, pythonOlder, isPy38
, astor
, gast
, google-pasta
, wrapt
, numpy
, six
, termcolor
, protobuf
, absl-py
, grpcio
, mock
, backports_weakref
, tensorflow-estimator_1
, tensorflow-tensorboard
, cudaSupport ? false
, cudatoolkit ? null
, cudnn ? null
, nvidia_x11 ? null
, zlib
, python
, symlinkJoin
, keras-applications
, keras-preprocessing
, addOpenGLRunpath
}:
# We keep this binary build for two reasons:
# - the source build doesn't work on Darwin.
# - the source build is currently brittle and not easy to maintain
assert cudaSupport -> cudatoolkit != null
&& cudnn != null
&& nvidia_x11 != null;
# unsupported combination
assert ! (stdenv.isDarwin && cudaSupport);
let
packages = import ./binary-hashes.nix;
variant = if cudaSupport then "-gpu" else "";
pname = "tensorflow${variant}";
in buildPythonPackage {
inherit pname;
inherit (packages) version;
format = "wheel";
disabled = isPy38;
src = let
pyVerNoDot = lib.strings.stringAsChars (x: if x == "." then "" else x) python.pythonVersion;
pyver = if stdenv.isDarwin then builtins.substring 0 1 pyVerNoDot else pyVerNoDot;
platform = if stdenv.isDarwin then "mac" else "linux";
unit = if cudaSupport then "gpu" else "cpu";
key = "${platform}_py_${pyver}_${unit}";
in fetchurl packages.${key};
propagatedBuildInputs = [
protobuf
numpy
termcolor
grpcio
six
astor
absl-py
gast
google-pasta
wrapt
tensorflow-estimator_1
tensorflow-tensorboard
keras-applications
keras-preprocessing
] ++ lib.optional (!isPy3k) mock
++ lib.optionals (pythonOlder "3.4") [ backports_weakref ];
nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath;
# Upstream has a pip hack that results in bin/tensorboard being in both tensorflow
# and the propageted input tensorflow-tensorboard which causes environment collisions.
# another possibility would be to have tensorboard only in the buildInputs
# https://github.com/tensorflow/tensorflow/blob/v1.7.1/tensorflow/tools/pip_package/setup.py#L79
postInstall = ''
rm $out/bin/tensorboard
'';
# Note that we need to run *after* the fixup phase because the
# libraries are loaded at runtime. If we run in preFixup then
# patchelf --shrink-rpath will remove the cuda libraries.
postFixup = let
rpath = stdenv.lib.makeLibraryPath
([ stdenv.cc.cc.lib zlib ] ++ lib.optionals cudaSupport [ cudatoolkit.out cudatoolkit.lib cudnn nvidia_x11 ]);
in
lib.optionalString stdenv.isLinux ''
rrPath="$out/${python.sitePackages}/tensorflow/:$out/${python.sitePackages}/tensorflow/contrib/tensor_forest/:${rpath}"
internalLibPath="$out/${python.sitePackages}/tensorflow/python/_pywrap_tensorflow_internal.so"
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
patchelf --set-rpath "$rrPath" "$lib"
${lib.optionalString cudaSupport ''
addOpenGLRunpath "$lib"
''}
done
'';
meta = with stdenv.lib; {
description = "Computation using data flow graphs for scalable machine learning";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ jyp abbradar ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
# Python 2.7 build uses different string encoding.
# See https://github.com/NixOS/nixpkgs/pull/37044#issuecomment-373452253
broken = stdenv.isDarwin && !isPy3k;
};
}

View File

@@ -0,0 +1,43 @@
{
version = "1.14.0";
linux_py_27_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp27-none-linux_x86_64.whl";
sha256 = "0yywdrfk97dh1bxhibspg0raz70fx9lcczj6xlimqy4xb60clx7k";
};
linux_py_35_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp35-cp35m-linux_x86_64.whl";
sha256 = "1xvyb6xcrjhlwvrmrhn5vs9xy7g98smqmpv4i3hhpry4qyasphhj";
};
linux_py_36_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp36-cp36m-linux_x86_64.whl";
sha256 = "1psd9vyxz9f39dwj77nvrg373sxv3p5vdp9fnz81dpsm0b0mwl44";
};
linux_py_37_cpu = {
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp37-cp37m-linux_x86_64.whl";
sha256 = "0bg2sb1n2ag27r7ww695kg5hb0mjrw4kc5893krmixx2j71860c5";
};
linux_py_27_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp27-none-linux_x86_64.whl";
sha256 = "0y1x91gayg6pjddgl8ndcm63wfzhyv4s5khgl7ffzsgni1ivaqw5";
};
linux_py_35_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp35-cp35m-linux_x86_64.whl";
sha256 = "03piggpbz1jx8m2b95spq3jrdff4w6xx63ji07am7hyw2nsgx3mx";
};
linux_py_36_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp36-cp36m-linux_x86_64.whl";
sha256 = "0ypkp8cfhharsyyikb1qgf44cfm6284km9xswzvzymjzz75vg3gd";
};
linux_py_37_gpu = {
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.14.0-cp37-cp37m-linux_x86_64.whl";
sha256 = "0virp8nn2ysx4855hq29kas6fm6b3dsiybwzdxy9nnb9n2d8qlm2";
};
mac_py_2_cpu = {
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py2-none-any.whl";
sha256 = "14f86k3pgq7z6i4s4im55zpp38f0drnm7xlclavsgcc0nxnj3z26";
};
mac_py_3_cpu = {
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py3-none-any.whl";
sha256 = "0f3swpcjfgqhj6h5wnx8snc0xjkx4hnkqx83fmlrwpncs8c131d3";
};
}

View File

@@ -1,13 +1,13 @@
{ stdenv, pkgs, bazel_0, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
{ stdenv, pkgs, bazel_0_26, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
, addOpenGLRunpath
# Python deps
, buildPythonPackage, isPy3k, isPy27, pythonOlder, pythonAtLeast, python
# Python libraries
, numpy, tensorflow-tensorboard, backports_weakref, mock, enum34, absl-py
, numpy, tensorflow-tensorboard_1, backports_weakref, mock, enum34, absl-py
, future, setuptools, wheel, keras-preprocessing, keras-applications, google-pasta
, functools32
, opt-einsum
, termcolor, grpcio, six, wrapt, protobuf, tensorflow-estimator_1_15_1
, termcolor, grpcio, six, wrapt, protobuf, tensorflow-estimator_1
# Common deps
, git, swig, which, binutils, glibcLocales, cython
# Common libraries
@@ -18,6 +18,7 @@
# it would also make the default tensorflow package unfree. See
# https://groups.google.com/a/tensorflow.org/forum/#!topic/developers/iRCt5m4qUz0
, cudaSupport ? false, nvidia_x11 ? null, cudatoolkit ? null, cudnn ? null, nccl ? null
, mklSupport ? false, mkl ? null
# XLA without CUDA is broken
, xlaSupport ? cudaSupport
# Default from ./configure script
@@ -36,6 +37,8 @@ assert cudaSupport -> nvidia_x11 != null
# unsupported combination
assert ! (stdenv.isDarwin && cudaSupport);
assert mklSupport -> mkl != null;
let
withTensorboard = pythonOlder "3.6";
@@ -94,7 +97,7 @@ let
bazel-build = buildBazelPackage {
name = "${pname}-${version}";
bazel = bazel_0;
bazel = bazel_0_26;
src = fetchFromGitHub {
owner = "tensorflow";
@@ -105,9 +108,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 +124,6 @@ let
sha256 = "1n9ypbrx36fc1kc9cz5b3p9qhg15xxhq4nz6ap3hwqba535nakfz";
})
(fetchpatch {
# be compatible with gast >0.2 instead of only gast 0.2.2
name = "gast-update.patch";
@@ -132,7 +134,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
@@ -168,6 +170,8 @@ let
cudatoolkit
cudnn
nvidia_x11
] ++ lib.optionals mklSupport [
mkl
] ++ lib.optionals stdenv.isDarwin [
Foundation
Security
@@ -285,7 +289,8 @@ let
];
bazelBuildFlags = [
"--config=opt" # optimize using the flags set in the configure phase
];
]
++ lib.optionals (mklSupport) [ "--config=mkl" ];
bazelTarget = "//tensorflow/tools/pip_package:build_pip_package //tensorflow/tools/lib_package:libtensorflow";
@@ -373,7 +378,7 @@ in buildPythonPackage {
numpy
six
protobuf
tensorflow-estimator_1_15_1
tensorflow-estimator_1
termcolor
wrapt
grpcio
@@ -385,7 +390,7 @@ in buildPythonPackage {
] ++ lib.optionals (pythonOlder "3.4") [
backports_weakref enum34
] ++ lib.optionals withTensorboard [
tensorflow-tensorboard
tensorflow-tensorboard_1
];
nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath;

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
version=1.14.0
hashfile=binary-hashes.nix
rm -f $hashfile
echo "{" >> $hashfile
echo "version = \"$version\";" >> $hashfile
for sys in "linux" "mac"; do
for tfpref in "cpu/tensorflow" "gpu/tensorflow_gpu"; do
for pykind in "py2-none-any" "py3-none-any" "cp27-none-linux_x86_64" "cp35-cp35m-linux_x86_64" "cp36-cp36m-linux_x86_64" "cp37-cp37m-linux_x86_64"; do
if [ $sys == "mac" ]; then
[[ $pykind =~ py.* ]] && [[ $tfpref =~ cpu.* ]]
result=$?
pyver=${pykind:2:1}
flavour=cpu
else
[[ $pykind =~ .*linux.* ]]
result=$?
pyver=${pykind:2:2}
flavour=${tfpref:0:3}
fi
if [ $result == 0 ]; then
url=https://storage.googleapis.com/tensorflow/$sys/$tfpref-$version-$pykind.whl
hash=$(nix-prefetch-url $url)
echo "${sys}_py_${pyver}_${flavour} = {" >> $hashfile
echo " url = \"$url\";" >> $hashfile
echo " sha256 = \"$hash\";" >> $hashfile
echo "};" >> $hashfile
fi
done
done
done
echo "}" >> $hashfile

View File

@@ -18,7 +18,7 @@
, wheel
, opt-einsum
, backports_weakref
, tensorflow-estimator
, tensorflow-estimator_2
, tensorflow-tensorboard
, cudaSupport ? false
, cudatoolkit ? null
@@ -76,7 +76,7 @@ in buildPythonPackage {
opt-einsum
google-pasta
wrapt
tensorflow-estimator
tensorflow-estimator_2
tensorflow-tensorboard
keras-applications
keras-preprocessing

View File

@@ -0,0 +1,427 @@
{ stdenv, pkgs, bazel_0_29, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
, addOpenGLRunpath
# Python deps
, buildPythonPackage, isPy3k, isPy27, pythonOlder, pythonAtLeast, python
# Python libraries
, numpy, tensorflow-tensorboard_2, 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_2
# Common deps
, git, swig, which, binutils, glibcLocales, cython
# Common libraries
, jemalloc, openmpi, astor, gast, grpc, sqlite, openssl, jsoncpp, re2
, curl, snappy, flatbuffers, icu, double-conversion, libpng, libjpeg, giflib
# Upsteam by default includes cuda support since tensorflow 1.15. We could do
# that in nix as well. It would make some things easier and less confusing, but
# it would also make the default tensorflow package unfree. See
# https://groups.google.com/a/tensorflow.org/forum/#!topic/developers/iRCt5m4qUz0
, cudaSupport ? false, nvidia_x11 ? null, cudatoolkit ? null, cudnn ? null, nccl ? null
, mklSupport ? false, mkl ? null
# XLA without CUDA is broken
, xlaSupport ? cudaSupport
# Default from ./configure script
, cudaCapabilities ? [ "3.5" "5.2" ]
, sse42Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512"]
, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512"]
, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512"]
# Darwin deps
, Foundation, Security
}:
assert cudaSupport -> nvidia_x11 != null
&& cudatoolkit != null
&& cudnn != null;
# unsupported combination
assert ! (stdenv.isDarwin && cudaSupport);
assert mklSupport -> mkl != null;
let
withTensorboard = pythonOlder "3.6";
cudatoolkit_joined = symlinkJoin {
name = "${cudatoolkit.name}-merged";
paths = [
cudatoolkit.lib
cudatoolkit.out
# for some reason some of the required libs are in the targets/x86_64-linux
# directory; not sure why but this works around it
"${cudatoolkit}/targets/${stdenv.system}"
];
};
cudatoolkit_cc_joined = symlinkJoin {
name = "${cudatoolkit.cc.name}-merged";
paths = [
cudatoolkit.cc
binutils.bintools # for ar, dwp, nm, objcopy, objdump, strip
];
};
# Needed for _some_ system libraries, grep INCLUDEDIR.
includes_joined = symlinkJoin {
name = "tensorflow-deps-merged";
paths = [
pkgs.protobuf
jsoncpp
];
};
tfFeature = x: if x then "1" else "0";
version = "2.1.0";
variant = if cudaSupport then "-gpu" else "";
pname = "tensorflow${variant}";
pythonEnv = python.withPackages (_:
[ # python deps needed during wheel build time (not runtime, see the buildPythonPackage part for that)
numpy
keras-preprocessing
protobuf
wrapt
gast
astor
absl-py
termcolor
keras-applications
setuptools
wheel
] ++ lib.optionals (!isPy3k)
[ future
functools32
mock
]);
bazel-build = buildBazelPackage {
name = "${pname}-${version}";
bazel = bazel_0_29;
src = fetchFromGitHub {
owner = "tensorflow";
repo = "tensorflow";
rev = "v${version}";
sha256 = "1g79xi8yl4sjia8ysk9b7xfzrz83zy28v5dlb2wzmcf0k5pmz60p";
};
patches = [
# Work around https://github.com/tensorflow/tensorflow/issues/24752
../no-saved-proto.patch
# Fixes for NixOS jsoncpp
../system-jsoncpp.patch
(fetchpatch {
name = "backport-pr-18950.patch";
url = "https://github.com/tensorflow/tensorflow/commit/73640aaec2ab0234d9fff138e3c9833695570c0a.patch";
sha256 = "1n9ypbrx36fc1kc9cz5b3p9qhg15xxhq4nz6ap3hwqba535nakfz";
})
(fetchpatch {
# Don't try to fetch things that don't exist
name = "prune-missing-deps.patch";
url = "https://github.com/tensorflow/tensorflow/commit/b39b1ed24b4814db27d2f748dc85c10730ae851d.patch";
sha256 = "1skysz53nancvw1slij6s7flar2kv3gngnsq60ff4lap88kx5s6c";
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
];
# On update, it can be useful to steal the changes from gentoo
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-libs/tensorflow
nativeBuildInputs = [
swig which pythonEnv
] ++ lib.optional cudaSupport addOpenGLRunpath;
buildInputs = [
jemalloc
openmpi
glibcLocales
git
# libs taken from system through the TF_SYS_LIBS mechanism
# grpc
sqlite
openssl
jsoncpp
pkgs.protobuf
curl
snappy
flatbuffers
icu
double-conversion
libpng
libjpeg
giflib
re2
pkgs.lmdb
] ++ lib.optionals cudaSupport [
cudatoolkit
cudnn
nvidia_x11
] ++ lib.optionals mklSupport [
mkl
] ++ lib.optionals stdenv.isDarwin [
Foundation
Security
];
# arbitrarily set to the current latest bazel version, overly careful
TF_IGNORE_MAX_BAZEL_VERSION = true;
# Take as many libraries from the system as possible. Keep in sync with
# list of valid syslibs in
# https://github.com/tensorflow/tensorflow/blob/master/third_party/systemlibs/syslibs_configure.bzl
TF_SYSTEM_LIBS = lib.concatStringsSep "," [
"absl_py"
"astor_archive"
"boringssl"
# Not packaged in nixpkgs
# "com_github_googleapis_googleapis"
# "com_github_googlecloudplatform_google_cloud_cpp"
"com_google_protobuf"
"com_googlesource_code_re2"
"curl"
"cython"
"double_conversion"
"flatbuffers"
"gast_archive"
# Lots of errors, requires an older version
# "grpc"
"hwloc"
"icu"
"jpeg"
"jsoncpp_git"
"keras_applications_archive"
"lmdb"
"nasm"
# "nsync" # not packaged in nixpkgs
"opt_einsum_archive"
"org_sqlite"
"pasta"
"pcre"
"six_archive"
"snappy"
"swig"
"termcolor_archive"
"wrapt"
"zlib_archive"
];
INCLUDEDIR = "${includes_joined}/include";
PYTHON_BIN_PATH = pythonEnv.interpreter;
TF_NEED_GCP = true;
TF_NEED_HDFS = true;
TF_ENABLE_XLA = tfFeature xlaSupport;
CC_OPT_FLAGS = " ";
# https://github.com/tensorflow/tensorflow/issues/14454
TF_NEED_MPI = tfFeature cudaSupport;
TF_NEED_CUDA = tfFeature cudaSupport;
TF_CUDA_PATHS = lib.optionalString cudaSupport "${cudatoolkit_joined},${cudnn},${nccl}";
GCC_HOST_COMPILER_PREFIX = lib.optionalString cudaSupport "${cudatoolkit_cc_joined}/bin";
GCC_HOST_COMPILER_PATH = lib.optionalString cudaSupport "${cudatoolkit_cc_joined}/bin/gcc";
TF_CUDA_COMPUTE_CAPABILITIES = lib.concatStringsSep "," cudaCapabilities;
postPatch = ''
# https://github.com/tensorflow/tensorflow/issues/20919
sed -i '/androidndk/d' tensorflow/lite/kernels/internal/BUILD
# Tensorboard pulls in a bunch of dependencies, some of which may
# include security vulnerabilities. So we make it optional.
# https://github.com/tensorflow/tensorflow/issues/20280#issuecomment-400230560
sed -i '/tensorboard >=/d' tensorflow/tools/pip_package/setup.py
'';
preConfigure = let
opt_flags = []
++ lib.optionals sse42Support ["-msse4.2"]
++ lib.optionals avx2Support ["-mavx2"]
++ lib.optionals fmaSupport ["-mfma"];
in ''
patchShebangs configure
# dummy ldconfig
mkdir dummy-ldconfig
echo "#!${stdenv.shell}" > dummy-ldconfig/ldconfig
chmod +x dummy-ldconfig/ldconfig
export PATH="$PWD/dummy-ldconfig:$PATH"
export PYTHON_LIB_PATH="$NIX_BUILD_TOP/site-packages"
export CC_OPT_FLAGS="${lib.concatStringsSep " " opt_flags}"
mkdir -p "$PYTHON_LIB_PATH"
# To avoid mixing Python 2 and Python 3
unset PYTHONPATH
'';
configurePhase = ''
runHook preConfigure
./configure
runHook postConfigure
'';
# FIXME: Tensorflow uses dlopen() for CUDA libraries.
NIX_LDFLAGS = lib.optionalString cudaSupport "-lcudart -lcublas -lcufft -lcurand -lcusolver -lcusparse -lcudnn";
hardeningDisable = [ "format" ];
bazelFlags = [
# temporary fixes to make the build work with bazel 0.27
"--incompatible_no_support_tools_in_action_inputs=false"
];
bazelBuildFlags = [
"--config=opt" # optimize using the flags set in the configure phase
]
++ lib.optionals (mklSupport) [ "--config=mkl" ];
bazelTarget = "//tensorflow/tools/pip_package:build_pip_package //tensorflow/tools/lib_package:libtensorflow";
fetchAttrs = {
# So that checksums don't depend on these.
TF_SYSTEM_LIBS = null;
# cudaSupport causes fetch of ncclArchive, resulting in different hashes
sha256 = if cudaSupport then
"0hg3ysy644950a34j28hrb317cz8gcbb9n84d36wdailvnlshghb"
else
"1gy4pz9kn30wb9c4a9584fibb88c3h38y3dqa99yw1lbsbyyi28c";
};
buildAttrs = {
outputs = [ "out" "python" ];
preBuild = ''
patchShebangs .
'';
installPhase = ''
mkdir -p "$out"
tar -xf bazel-bin/tensorflow/tools/lib_package/libtensorflow.tar.gz -C "$out"
# Write pkgconfig file.
mkdir "$out/lib/pkgconfig"
cat > "$out/lib/pkgconfig/tensorflow.pc" << EOF
Name: TensorFlow
Version: ${version}
Description: Library for computation using data flow graphs for scalable machine learning
Requires:
Libs: -L$out/lib -ltensorflow
Cflags: -I$out/include/tensorflow
EOF
# build the source code, then copy it to $python (build_pip_package
# actually builds a symlink farm so we must dereference them).
bazel-bin/tensorflow/tools/pip_package/build_pip_package --src "$PWD/dist"
cp -Lr "$PWD/dist" "$python"
'';
postFixup = lib.optionalString cudaSupport ''
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
addOpenGLRunpath "$lib"
done
'';
};
meta = with stdenv.lib; {
description = "Computation using data flow graphs for scalable machine learning";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ jyp abbradar ];
platforms = with platforms; linux ++ darwin;
# The py2 build fails due to some issue importing protobuf. Possibly related to the fix in
# https://github.com/akesandgren/easybuild-easyblocks/commit/1f2e517ddfd1b00a342c6abb55aef3fd93671a2b
broken = !(xlaSupport -> cudaSupport) || !isPy3k;
};
};
in buildPythonPackage {
inherit version pname;
disabled = isPy27 || (pythonAtLeast "3.8");
src = bazel-build.python;
# Upstream has a pip hack that results in bin/tensorboard being in both tensorflow
# and the propagated input tensorflow-tensorboard, which causes environment collisions.
# Another possibility would be to have tensorboard only in the buildInputs
# https://github.com/tensorflow/tensorflow/blob/v1.7.1/tensorflow/tools/pip_package/setup.py#L79
postInstall = ''
rm $out/bin/tensorboard
'';
setupPyGlobalFlags = [ "--project_name ${pname}" ];
# tensorflow/tools/pip_package/setup.py
propagatedBuildInputs = [
absl-py
astor
gast
google-pasta
keras-applications
keras-preprocessing
numpy
six
protobuf
tensorflow-estimator_2
termcolor
wrapt
grpcio
opt-einsum
] ++ lib.optionals (!isPy3k) [
mock
future
functools32
] ++ lib.optionals (pythonOlder "3.4") [
backports_weakref enum34
] ++ lib.optionals withTensorboard [
tensorflow-tensorboard_2
];
nativeBuildInputs = lib.optional cudaSupport addOpenGLRunpath;
postFixup = lib.optionalString cudaSupport ''
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
addOpenGLRunpath "$lib"
done
'';
# Actual tests are slow and impure.
# TODO try to run them anyway
# TODO better test (files in tensorflow/tools/ci_build/builds/*test)
checkPhase = ''
${python.interpreter} <<EOF
# A simple "Hello world"
import tensorflow as tf
hello = tf.constant("Hello, world!")
tf.print(hello)
# Fit a simple model to random data
import numpy as np
np.random.seed(0)
tf.random.set_seed(0)
model = tf.keras.models.Sequential([
tf.keras.layers.Dense(1, activation="linear")
])
model.compile(optimizer="sgd", loss="mse")
x = np.random.uniform(size=(1,1))
y = np.random.uniform(size=(1,))
model.fit(x, y, epochs=1)
EOF
'';
# Regression test for #77626 removed because not more `tensorflow.contrib`.
passthru.libtensorflow = bazel-build.out;
inherit (bazel-build) meta;
}

View File

@@ -0,0 +1,11 @@
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index 992f2eae22..d9386f9b13 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -54,5 +54,5 @@ REQUIRED_PACKAGES = [
'enum34 >= 1.1.6;python_version<"3.4"',
- 'gast == 0.2.2',
+ 'gast >= 0.2.2',
'google_pasta >= 0.1.6',
'keras_applications >= 1.0.8',
'keras_preprocessing >= 1.0.5',