Skip to content

Commit 33c0e35

Browse files
michaelosthegetwiecki
authored andcommitted
Print informative warning when too old Theano version is imported
Closes #4527
1 parent 3079983 commit 33c0e35

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pymc3/__init__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import multiprocessing as mp
2020
import platform
2121

22+
import semver
23+
import theano
24+
2225
_log = logging.getLogger("pymc3")
2326

2427
if not logging.root.handlers:
@@ -28,10 +31,18 @@
2831
_log.addHandler(handler)
2932

3033

34+
if not semver.match(theano.__version__, ">=1.1.2"):
35+
print(
36+
"!" * 60
37+
+ f"\nThe installed Theano(-PyMC) version ({theano.__version__}) does not match the PyMC3 requirements."
38+
+ "\nFor PyMC3 to work, Theano must be uninstalled and replaced with Theano-PyMC."
39+
+ "\nSee https://github.com/pymc-devs/pymc3/wiki for installation instructions.\n"
40+
+ "!" * 60
41+
)
42+
43+
3144
def __set_compiler_flags():
3245
# Workarounds for Theano compiler problems on various platforms
33-
import theano
34-
3546
current = theano.config.gcc__cxxflags
3647
theano.config.gcc__cxxflags = f"{current} -Wno-c++11-narrowing"
3748

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ numpy>=1.15.0
66
pandas>=0.24.0
77
patsy>=0.5.1
88
scipy>=1.2.0
9+
semver
910
theano-pymc==1.1.2
1011
typing-extensions>=3.7.4

0 commit comments

Comments
 (0)