diff --git a/.travis.yml b/.travis.yml index 432216fb3a..f544cdd945 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ env: - FLOATX='float64' TESTCMD="--durations=10 --cov-append pymc3/tests/test_distributions_random.py pymc3/tests/test_shared.py pymc3/tests/test_smc.py pymc3/tests/test_sampling.py pymc3/tests/test_parallel_sampling.py pymc3/tests/test_dist_math.py pymc3/tests/test_distribution_defaults.py pymc3/tests/test_distributions_timeseries.py pymc3/tests/test_random.py" - FLOATX='float64' TESTCMD="--durations=10 --cov-append pymc3/tests/test_examples.py pymc3/tests/test_posteriors.py pymc3/tests/test_gp.py" - FLOATX='float64' TESTCMD="--durations=10 --cov-append pymc3/tests/test_variational_inference.py pymc3/tests/test_updates.py pymc3/tests/test_shape_handling.py" + - PYTHON_VERSION=3.5 FLOATX='float64' ENVNAME="py35_testenv" TESTCMD="--cov-append pymc3/tests/test_sampling.py pymc3/tests/test_model_graph.py" script: - . ./scripts/test.sh $TESTCMD diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1fe060bef1..51f2376f7d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -45,6 +45,7 @@ - Fixed an issue in `model_graph` that caused construction of the graph of the model for rendering to hang: replaced a search over the powerset of the nodes with a breadth-first search over the nodes. Fix for #3458. - Removed variable annotations from `model_graph` but left type hints (Fix for #3465). This means that we support `python>=3.5.4`. - Default `target_accept`for `HamiltonianMC` is now 0.65, as suggested in Beskos et. al. 2010 and Neal 2001. +- Fixed bug in `draw_values` that lead to intermittent errors in python3.5. This happened with some deterministic nodes that were drawn but not added to `givens`. ### Deprecations diff --git a/pymc3/distributions/distribution.py b/pymc3/distributions/distribution.py index 0164ff691d..b455480e36 100644 --- a/pymc3/distributions/distribution.py +++ b/pymc3/distributions/distribution.py @@ -401,8 +401,7 @@ def draw_values(params, point=None, size=None): # nodes in the `params` list. stack.extend([node for node in named_nodes_parents[next_] if node is not None and - (node, size) not in drawn and - node not in params]) + (node, size) not in drawn]) # the below makes sure the graph is evaluated in order # test_distributions_random::TestDrawValues::test_draw_order fails without it @@ -420,6 +419,20 @@ def draw_values(params, point=None, size=None): evaluated[param_idx] = drawn[(param, size)] else: try: # might evaluate in a bad order, + # Sometimes _draw_value recurrently calls draw_values. + # This may set values for certain nodes in the drawn + # dictionary, but they don't get added to the givens + # dictionary. Here, we try to fix that. + if param in named_nodes_children: + for node in named_nodes_children[param]: + if ( + node.name not in givens and + (node, size) in drawn + ): + givens[node.name] = ( + node, + drawn[(node, size)] + ) value = _draw_value(param, point=point, givens=givens.values(), diff --git a/scripts/create_testenv.sh b/scripts/create_testenv.sh index 7604fc330e..8970f0e675 100755 --- a/scripts/create_testenv.sh +++ b/scripts/create_testenv.sh @@ -20,7 +20,7 @@ command -v conda >/dev/null 2>&1 || { exit 1; } -ENVNAME="testenv" +ENVNAME="${ENVNAME:-testenv}" # if no ENVNAME is specified, use testenv PYTHON_VERSION=${PYTHON_VERSION:-3.6} # if no python specified, use 3.6 if [ -z ${GLOBAL} ] @@ -33,10 +33,11 @@ then fi source activate ${ENVNAME} fi -conda install --yes numpy scipy mkl-service +pip install --upgrade pip + +conda install --yes mkl-service conda install --yes -c conda-forge python-graphviz -pip install --upgrade pip # Install editable using the setup.py diff --git a/scripts/install_miniconda.sh b/scripts/install_miniconda.sh index 6db6f64934..b4035f4528 100755 --- a/scripts/install_miniconda.sh +++ b/scripts/install_miniconda.sh @@ -46,3 +46,5 @@ fi export PATH="$INSTALL_FOLDER/bin:$PATH" echo "Adding $INSTALL_FOLDER to PATH. Consider adding it in your .rc file as well." conda update -q -y conda +# Uninstalling miniconda's numpy to avoid conflicting versions when creating the test env +pip uninstall -y numpy diff --git a/setup.py b/setup.py index f6bb2b2e38..014b9e39ea 100755 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ def get_version(): package_data={'docs': ['*']}, include_package_data=True, classifiers=classifiers, + python_requires=">=3.5.4", install_requires=install_reqs, extras_require={ "plots": ["arviz"],