python fbprophet包下载时出现的问题解决

fbprophet包下载时出现的问题解决:​​​​​​​
1. 删除当前pystan; pip uninstall pystan。
2. 删除当前fbprophet;pip uninstall fbprophet。
3. 删除单独的prophet包(如果有安装的话)
4. 重新安装pystan:pip install pystan --no-cache。
5.重新安装fbprophet:pip install fbprophet --no-cache。...


如果出现pystan和fbprophet都已经下载好,但运行时却出现:

1. 'StanModel' object has no attribute 'fit_class';

2.  C++编译器问题,INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_b061d14b15cea7d7e6cf0b7700a8b143 NOW. /anaconda3/lib/python3.6/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive ‘language_level’ not set, using 2 for now (Py2). This will change in a later release! File: /var/folders/r9/xxppbx0s5q190x6xqpsjcx6m0000gp/T/tmp5h3kq2c2/stanfit4anon_model_b061d14b15cea7d7e6cf0b7700a8b143_8651377948048783664.pyx tree = Parsing.p_module(s, pxd, full_module_name);

3. ERROR: Could not find a version that satisfies the requirement fbrophet (from versions: none)。ERROR: No matching distribution found for fbrophet。

4. ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. prophet 1.1 requires cmdstanpy>=1.0.1, but you have cmdstanpy 0.9.5 which is incompatible.

等等。。。

会出现这些情况,大概率是因为fbprophet下载的姿势不对,fbprophet包内的小包不兼容。要谨防直接pip install fbprophet,这可能会带来版本不兼容。

 这时可以采取的解决办法:

1.  删除当前pystan; pip uninstall pystan。

2. 删除当前fbprophet;pip uninstall fbprophet。

3. 删除单独的prophet包(如果有安装的话),这可能会和fbprophet内的小包起版本冲突(如第四条),可以理解为在from fbprophet import Prophet时真假美猴王。

4. 重新安装pystan:pip install pystan --no-cache

5. 重新安装fbprophet:pip install fbprophet --no-cache

奇妙的知识增加:增加一个 --no-cache: This ensures all additional layers in the Dockerfile get rebuilt from scratch, instead of relying on the layer cache.

P.S. 毋需单独卸载cmdstanpy等prophet/fbprophet内小包版本,即出现第四条,不建议通过pip install XX--version或者pip install --upgrade XX来单独调整,这可能会导致其他版本问题出现。一般来说,正确的姿势下载是不会出现版本不兼容问题,而且再次下载fbprophet时,会自动调整到兼容版本。

Reference: https://github.com/facebook/prophet/issues/599


版权声明:本文为weixin_48158328原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。