Skip to content

Commit c7cf172

Browse files
michaelosthegetwiecki
authored andcommitted
Add prominent warnings about having theano/pymc3 installed in parallel
1 parent 8c59b41 commit c7cf172

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

pymc/__init__.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# pylint: disable=wildcard-import
16-
__version__ = "4.0"
16+
__version__ = "4.0.0"
1717

1818
import logging
1919
import multiprocessing as mp
@@ -27,6 +27,38 @@
2727
handler = logging.StreamHandler()
2828
_log.addHandler(handler)
2929

30+
31+
def _check_install_compatibilitites():
32+
try:
33+
import theano
34+
35+
print(
36+
"!" * 60
37+
+ f"\nYour Python environment has Theano(-PyMC) {theano.__version__} installed, "
38+
+ f"but you are importing PyMC {__version__} which uses Aesara as its backend."
39+
+ f"\nFor PyMC {__version__} to work as expected you should uninstall Theano(-PyMC)."
40+
+ "\nSee https://github.com/pymc-devs/pymc3/wiki for installation instructions.\n"
41+
+ "!" * 60
42+
)
43+
except ImportError:
44+
pass
45+
46+
try:
47+
import pymc3
48+
49+
print(
50+
"!" * 60
51+
+ f"\nYou are importing PyMC {__version__}, but your environment also has"
52+
+ f" the legacy version PyMC3 {pymc3.__version__} installed."
53+
+ f"\nFor PyMC {__version__} to work as expected you should uninstall PyMC3."
54+
+ "\nSee https://github.com/pymc-devs/pymc3/wiki for installation instructions.\n"
55+
+ "!" * 60
56+
)
57+
except ImportError:
58+
pass
59+
60+
61+
_check_install_compatibilitites()
3062
_log.info(
3163
"You are running the v4 development version of PyMC which currently still lacks key features. You probably want to use the stable v3 instead which you can either install via conda or find on the v3 GitHub branch: https://github.com/pymc-devs/pymc/tree/v3"
3264
)

0 commit comments

Comments
 (0)