PyMC3 兼容性问题解决

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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容