前提条件
- Windows 10 or Mac
- Miniconda 3 の最新安定板
「極力CUIでゼロからDjango開発環境を構築」と同様の手順を実行して、PowershellまたはターミナルでMiniconda 3が使用できるようになっていること
仮想環境を作成して有効化
(base) PS> conda create -n prophet-test
(base) PS> conda activate prophet-test
(prophet-test) PS>
Mac ターミナル の場合
(base) $ conda create -n prophet-test
(base) $ source activate prophet-test
(prophet-test) $
- Windows では `conda` なのに Mac では `source`
- `prophet-test`は任意の文字列に置き換えできる
- 右端の()の中が現在な仮想環境
Prophetをインストール
(prophet-test) PS> conda install -c conda-forge fbprophet
参考: https://facebook.github.io/prophet/docs/installation.html
この1コマンドで関連ライブラリがconda-forgeからインストールされ、最後にProphetがインストールされる。
ストーリー
pipを使用してpystanやprophetを以下のようにインストールしてみたが、上手く行かなかった。
(prophet-test)> conda install numpy matplotlib pandas
(prophet-test)> pip install -U pystan
(prophet-test)> pip install -U fbprophet
ここで Successful installing という表示は出た。
しかしコーディングを始めると、AttributeError が発生してコードが正常に実行されない。
pip install -U pystan
をconda install pystan
に変えてもダメだった。
そこで、https://facebook.github.io/prophet/ を見ていたらWindowsとLinuxに並んでAnacondaの記述を発見。
Use conda install gcc to set up gcc. The easiest way to install Prophet is through conda-forge: conda install -c conda-forge fbprophet.
ということは、
(prophet-test)> conda install numpy matplotlib pandas
(prophet-test)> conda install gcc
(prophet-test)> conda install -c conda-forge fbprophet
(prophet-test)> pip install pystan
(prophet-test)> pip install fbprophet
でよさそう。
The major dependency that Prophet has is pystan. PyStan has its own installation instructions.
https://pystan.readthedocs.io/en/latest/installation_beginner.html
を見るとWin とMacでC言語関連のインストール方法が違うらしい。これによって、Pystanのインストール手順に差が生まれる模様。
Excelsior!