mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-08 19:45:42 +03:00
python3Packages.tensorflow-probability: 0.8 -> 0.15.0
tensorflow-probability 0.8 was broken and marked as such (in #108977) because of a dependency on dm-tree, which seems not to have been available. Since dm-tree is now available in nixpkgs (#152971), tensorflow-probability is easy to fix and to upgrade.
This commit is contained in:
parent
f304633689
commit
38aba237ad
1 changed files with 18 additions and 37 deletions
|
@ -1,7 +1,5 @@
|
||||||
{ lib
|
{ lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchpatch
|
|
||||||
, bazel_0_26
|
|
||||||
, buildBazelPackage
|
, buildBazelPackage
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, python
|
, python
|
||||||
|
@ -11,47 +9,33 @@
|
||||||
, tensorflow
|
, tensorflow
|
||||||
, six
|
, six
|
||||||
, numpy
|
, numpy
|
||||||
|
, dm-tree
|
||||||
|
, keras
|
||||||
, decorator
|
, decorator
|
||||||
, cloudpickle
|
, cloudpickle
|
||||||
, gast
|
, gast
|
||||||
, hypothesis
|
, hypothesis
|
||||||
, scipy
|
, scipy
|
||||||
|
, pandas
|
||||||
|
, mpmath
|
||||||
, matplotlib
|
, matplotlib
|
||||||
, mock
|
, mock
|
||||||
, pytest
|
, pytest
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "0.8.0";
|
version = "0.15.0";
|
||||||
pname = "tensorflow_probability";
|
pname = "tensorflow_probability";
|
||||||
|
|
||||||
# first build all binaries and generate setup.py using bazel
|
# first build all binaries and generate setup.py using bazel
|
||||||
bazel-wheel = buildBazelPackage {
|
bazel-wheel = buildBazelPackage {
|
||||||
bazel = bazel_0_26;
|
|
||||||
|
|
||||||
name = "${pname}-${version}-py2.py3-none-any.whl";
|
name = "${pname}-${version}-py2.py3-none-any.whl";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "tensorflow";
|
owner = "tensorflow";
|
||||||
repo = "probability";
|
repo = "probability";
|
||||||
rev = version;
|
rev = "v" + version;
|
||||||
sha256 = "07cm8zba8n0ihzdm3k4a4rsg5v62xxsfvcw4h0niz91c0parqjqy";
|
sha256 = "155fgmra90s08vjnp61qxdrpzq74xa3kdzhgdkavwgc25pvxn3mi";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
|
||||||
(fetchpatch {
|
|
||||||
name = "gast-0.3.patch";
|
|
||||||
url = "https://github.com/tensorflow/probability/commit/ae7a9d9771771ec1e7755a3588b9325f050a84cc.patch";
|
|
||||||
sha256 = "0kfhx30gshm8f3945na9yjjik71r20qmjzifbigaj4l8dwd9dz1a";
|
|
||||||
excludes = ["testing/*"];
|
|
||||||
})
|
|
||||||
(fetchpatch {
|
|
||||||
name = "cloudpickle-1.2.patch";
|
|
||||||
url = "https://github.com/tensorflow/probability/commit/78ef12b5afe3f567d16c70b74015ed1ddff1b0c8.patch";
|
|
||||||
sha256 = "12ms2xcljvvrnig0j78s3wfv4yf3bm5ps4rgfgv5lg2a8mzpc1ga";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
# needed to create the output wheel in installPhase
|
# needed to create the output wheel in installPhase
|
||||||
python
|
python
|
||||||
|
@ -64,7 +48,7 @@ let
|
||||||
bazelTarget = ":pip_pkg";
|
bazelTarget = ":pip_pkg";
|
||||||
|
|
||||||
fetchAttrs = {
|
fetchAttrs = {
|
||||||
sha256 = "1qw7vkwnxy45z4vm94isq5m96xiz35sigag7vjg1xb2sklbymxh8";
|
sha256 = "0sgxdlw5x3dydy53l10vbrj8smh78b7r1wff8jxcgp4w69mk8zfm";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildAttrs = {
|
buildAttrs = {
|
||||||
|
@ -98,34 +82,31 @@ in buildPythonPackage {
|
||||||
decorator
|
decorator
|
||||||
cloudpickle
|
cloudpickle
|
||||||
gast
|
gast
|
||||||
|
dm-tree
|
||||||
|
keras
|
||||||
];
|
];
|
||||||
|
|
||||||
# Listed here:
|
# Listed here:
|
||||||
# https://github.com/tensorflow/probability/blob/f01d27a6f256430f03b14beb14d37def726cb257/testing/run_tests.sh#L58
|
# https://github.com/tensorflow/probability/blob/f3777158691787d3658b5e80883fe1a933d48989/testing/dependency_install_lib.sh#L83
|
||||||
checkInputs = [
|
checkInputs = [
|
||||||
hypothesis
|
hypothesis
|
||||||
pytest
|
pytest
|
||||||
scipy
|
scipy
|
||||||
|
pandas
|
||||||
|
mpmath
|
||||||
matplotlib
|
matplotlib
|
||||||
mock
|
mock
|
||||||
];
|
];
|
||||||
|
|
||||||
# actual checks currently fail because for some reason
|
# Ideally, we run unit tests with pytest, but in checkPhase, only the Bazel-build wheel is available.
|
||||||
# tf.enable_eager_execution is called too late. Probably because upstream
|
# But it seems not guaranteed that running the tests with pytest will even work, see
|
||||||
# intents these tests to be run by bazel, not plain pytest.
|
# https://github.com/tensorflow/probability/blob/c2a10877feb2c4c06a4dc58281e69c37a11315b9/CONTRIBUTING.md?plain=1#L69
|
||||||
# checkPhase = ''
|
# Ideally, tests would be run using Bazel. For now, lets's do a...
|
||||||
# # tests need to import from other test files
|
|
||||||
# export PYTHONPATH="$PWD/tensorflow-probability:$PYTHONPATH"
|
|
||||||
# py.test
|
|
||||||
# '';
|
|
||||||
|
|
||||||
# sanity check
|
# sanity check
|
||||||
checkPhase = ''
|
pythonImportsCheck = [ "tensorflow_probability" ];
|
||||||
python -c 'import tensorflow_probability'
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
broken = true; # tf-probability 0.8.0 is not compatible with tensorflow 2.3.2
|
|
||||||
description = "Library for probabilistic reasoning and statistical analysis";
|
description = "Library for probabilistic reasoning and statistical analysis";
|
||||||
homepage = "https://www.tensorflow.org/probability/";
|
homepage = "https://www.tensorflow.org/probability/";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue