Prophet安装教程

写在前面

Prophet安装会遇到的主要问题是版本冲突,其中又主要是pystan和fbprophet的版本问题。这里用conda安装,指定版本的话三步可完成,如果是新建的虚拟环境不会遇到其它问题。

先安装其它库,prophet相关库最后安装
强烈建议使用conda安装,关键词:指定版本!

可能需要的前置知识:

  1. conda新建虚拟环境以及其它常用命令在这
  2. conda的channels设置,我是直接修改的配置文件,最终的channels地址:
channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

不解决channels的话容易遇到下面这个报错

Solving environment: failed with initial frozen solve.

一、安装pystan

conda install pystan==2.19.1.1

指定2.X的版本原因:

  1. 避免import失败 ,参考这里,pystan3.X版本替换了import语句。指定2.X之后可避免:

ModuleNotFoundError: No module named ‘pystan’;

二、安装fbprophet

conda install fbprophet==0.7.1 -c conda-forge

Prophet有prophetfbprophet两个包可以安装,我这里用的是fbprophet

指定0.7.1的原因:

  1. 避免holidays包版本出现冲突,fbprophet版本0.5以下适配的holidays包版本较低,报错如下:

ImportError: cannot import name ‘easter’ from ‘holidays’

三、安装plotly

conda install plotly

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