PyMC3 兼容性问题解决

2022-05-01  本文已影响0人  青云直上

PyMC3是python里做贝叶斯分析的一个包,这个包还依赖于Theano。而在最新的3.10.0版本的PyMC3与Theano之间有严重的兼容性问题。比如import的时候会遇到以下问题

ImportError: cannot import name 'is_same_graph'

建议把PyMC3和Theano都卸载掉,重新以兼容性好的版本安装。

pip install pymc3==3.8.0
pip install theano == 1.0.5

再试一下,问题仍然没有解决!网上找了很多文章都过时了!

最后还是去官方Github,
Installation Guide (MacOS) · pymc-devs/pymc Wiki · GitHub

新款mac new M1 chip

conda create -c conda-forge -n pymc3_env python=3.9 pymc3
conda activate pymc3_env

旧款mac (Intel) Macs:

conda create -c conda-forge -n pymc3_env python=3.9 pymc3 theano-pymc mkl mkl-service
conda activate pymc3_env

Note that you must specifically request theano-pymc or you will get an obsolete version of PyMC3 that works with the now-abandoned theano library. We encourage you to test this with the --dry-run flag to ensure you get up-to-date versions.

上一篇 下一篇

猜你喜欢

热点阅读