Skip to content

Commit 80dae6b

Browse files
treszkaiLaszlo Treszkai
and
Laszlo Treszkai
authored
Workaround Theano issue with NumPy>=1.22.0 (#5310) (see #5316)
Co-authored-by: Laszlo Treszkai <[email protected]>
1 parent 1a24abf commit 80dae6b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

RELEASE-NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
+ The `pm.Distribution(testval=...)` kwarg was deprecated and will be replaced by `pm.Distribution(initval=...)`in `pymc >=4` (see [#5226](https://github.com/pymc-devs/pymc/pulls/5226)).
77
+ The `pm.sample(start=...)` kwarg was deprecated and will be replaced by `pm.sample(initvals=...)`in `pymc >=4` (see [#5226](https://github.com/pymc-devs/pymc/pulls/5226)).
88

9+
### Bugfixes
10+
+ A hotfix is applied on import to remain compatible with NumPy 1.22 (see [#5316](https://github.com/pymc-devs/pymc/pull/5316)).
11+
912
## PyMC3 3.11.4 (20 August 2021)
1013

1114
### New Features

pymc3/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,30 @@
1818
import logging
1919
import multiprocessing as mp
2020
import platform
21+
import warnings
2122

23+
import numpy.distutils
2224
import semver
25+
26+
# Workaround for Theano bug that tries to access blas_opt_info;
27+
# must be done before importing theano.
28+
# https://github.com/pymc-devs/pymc/issues/5310
29+
# Copied from theano/link/c/cmodule.py: default_blas_ldflags()
30+
if (
31+
hasattr(numpy.distutils, "__config__")
32+
and numpy.distutils.__config__
33+
and not hasattr(numpy.distutils.__config__, "blas_opt_info")
34+
):
35+
import numpy.distutils.system_info # noqa
36+
37+
# We need to catch warnings as in some cases NumPy print
38+
# stuff that we don't want the user to see.
39+
with warnings.catch_warnings(record=True):
40+
numpy.distutils.system_info.system_info.verbosity = 0
41+
blas_info = numpy.distutils.system_info.get_info("blas_opt")
42+
43+
numpy.distutils.__config__.blas_opt_info = blas_info
44+
2345
import theano
2446

2547
_log = logging.getLogger("pymc3")

0 commit comments

Comments
 (0)