Merge pull request #156027 from simeoncarstens/fix-tfp

This commit is contained in:
Sandro 2022-01-30 00:39:25 +01:00 committed by GitHub
commit cfeee25aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 49 deletions

View File

@ -9,11 +9,14 @@
, numpy
, pandas
, pytest
, cloudpickle
, scipy
, setuptools
, tensorflow-probability
, typing-extensions
# , tensorflow-probability (incompatible version)
, xarray
#, h5py (used by disabled tests)
, zarr
, h5py
#, pymc3 (broken)
#, pyro-ppl (broken)
#, pystan (not packaged)
@ -45,28 +48,36 @@ buildPythonPackage rec {
scipy
];
postPatch = ''
substituteInPlace requirements.txt \
--replace "typing_extensions>=3.7.4.3,<4" "typing_extensions>=3.7.4.3"
'';
checkInputs = [
bokeh
emcee
numba
pytest
tensorflow-probability
#h5py (used by disabled tests)
#pymc3 (broken)
#pyro-ppl (broken)
cloudpickle
zarr
#tensorflow-probability (used by disabled tests)
h5py
#pymc3 (broken, used by disabled tests)
#pyro-ppl (broken, used by disabled tests)
#pystan (not packaged)
#numpyro (not packaged)
#numpyro (not packaged, used by disabled tests)
];
# check requires pymc3 and pyro-ppl, which are currently broken, and pystan
# and numpyro, which are not yet packaged, some checks also need to make
# and numpyro, which are not yet packaged, and an incompatible (old) version
# of tensorflow-probability. some checks also need to make
# directories and do not have permission to do so. So we can only check part
# of the package
# Additionally, there are some failures with the plots test, which revolve
# around attempting to output .mp4 files through an interface that only wants
# to output .html files.
# The following test have been disabled as a result: data_cmdstanpy,
# data_numpyro, data_pyro, data_pystan, and plots.
# data_numpyro, data_pyro, data_pystan, data_tfp, data_pymc3 and plots.
checkPhase = ''
cd arviz/tests/
export HOME=$TMPDIR
@ -76,11 +87,13 @@ buildPythonPackage rec {
base_tests/test_plot_utils.py \
base_tests/test_rcparams.py \
base_tests/test_stats.py \
base_tests/test_stats_numba.py \
base_tests/test_stats_utils.py \
base_tests/test_utils.py \
base_tests/test_utils_numba.py \
base_tests/test_data_zarr.py \
external_tests/test_data_cmdstan.py \
external_tests/test_data_emcee.py \
external_tests/test_data_tfp.py
external_tests/test_data_emcee.py
'';
meta = with lib; {

View File

@ -86,5 +86,6 @@ in buildPythonPackage {
license = licenses.asl20;
maintainers = with maintainers; [ timokau ];
platforms = platforms.linux;
broken = true; # depends on older TensorFlow version than is currently packaged
};
}

View File

@ -68,5 +68,8 @@ buildPythonPackage rec {
homepage = "https://github.com/pymc-devs/pymc3";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ ilya-kolpakov ];
# several dependencies are not declared and in the end it requires theano-pymc3
# instead of Theano. The former is currently not packaged.
broken = true;
};
}

View File

@ -1,7 +1,5 @@
{ lib
, fetchFromGitHub
, fetchpatch
, bazel_0_26
, buildBazelPackage
, buildPythonPackage
, python
@ -11,47 +9,33 @@
, tensorflow
, six
, numpy
, dm-tree
, keras
, decorator
, cloudpickle
, gast
, hypothesis
, scipy
, pandas
, mpmath
, matplotlib
, mock
, pytest
}:
let
version = "0.8.0";
version = "0.15.0";
pname = "tensorflow_probability";
# first build all binaries and generate setup.py using bazel
bazel-wheel = buildBazelPackage {
bazel = bazel_0_26;
name = "${pname}-${version}-py2.py3-none-any.whl";
src = fetchFromGitHub {
owner = "tensorflow";
repo = "probability";
rev = version;
sha256 = "07cm8zba8n0ihzdm3k4a4rsg5v62xxsfvcw4h0niz91c0parqjqy";
rev = "v" + version;
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 = [
# needed to create the output wheel in installPhase
python
@ -64,7 +48,7 @@ let
bazelTarget = ":pip_pkg";
fetchAttrs = {
sha256 = "1qw7vkwnxy45z4vm94isq5m96xiz35sigag7vjg1xb2sklbymxh8";
sha256 = "0sgxdlw5x3dydy53l10vbrj8smh78b7r1wff8jxcgp4w69mk8zfm";
};
buildAttrs = {
@ -98,34 +82,31 @@ in buildPythonPackage {
decorator
cloudpickle
gast
dm-tree
keras
];
# 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 = [
hypothesis
pytest
scipy
pandas
mpmath
matplotlib
mock
];
# actual checks currently fail because for some reason
# tf.enable_eager_execution is called too late. Probably because upstream
# intents these tests to be run by bazel, not plain pytest.
# checkPhase = ''
# # tests need to import from other test files
# export PYTHONPATH="$PWD/tensorflow-probability:$PYTHONPATH"
# py.test
# '';
# Ideally, we run unit tests with pytest, but in checkPhase, only the Bazel-build wheel is available.
# But it seems not guaranteed that running the tests with pytest will even work, see
# https://github.com/tensorflow/probability/blob/c2a10877feb2c4c06a4dc58281e69c37a11315b9/CONTRIBUTING.md?plain=1#L69
# Ideally, tests would be run using Bazel. For now, lets's do a...
# sanity check
checkPhase = ''
python -c 'import tensorflow_probability'
'';
pythonImportsCheck = [ "tensorflow_probability" ];
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";
homepage = "https://www.tensorflow.org/probability/";
license = licenses.asl20;

View File

@ -2,6 +2,7 @@
, fetchPypi
, buildPythonPackage
, pythonOlder
, pythonAtLeast
, numpy
, wheel
, werkzeug
@ -24,7 +25,7 @@ buildPythonPackage rec {
pname = "tensorflow-tensorboard";
version = "2.6.0";
format = "wheel";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.6" || pythonAtLeast "3.10";
src = fetchPypi {
pname = "tensorboard";