Facebook的开放源码排程预测库fbprophet袖珍史上最难加装的库,剖面的确这般。
腾讯了各式各样单纯蛮横或是详尽的加装关键步骤,前夕遭受了各式各样怪异的难题,现简录如下表所示:
1.早已加装了pystan的大前提下,用conda install -c conda-forge install fbprophet,
(base) C:\WINDOWS\system32>conda install -c conda-forge fbprophet
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
2.再次出现前述难题,我试著了用图书馆员职权conda update --all, 等大部份的包都预览完后,再度conda install -c conda-forge install fbprophet , 念出另两个自然环境不相匹配的难题,我的python版是3.9,与fbprophet不相容。
(base) C:\WINDOWS\system32>conda install -c conda-forge fbprophet
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- fbprophet -> python[version=2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0]
Your python: python=3.9
3.在Anaconda中创建python3.7的虚拟自然环境:
conda create -n py37 python=3.7
4.激活并进入虚拟自然环境,然后再加装fbprophet:
(base) C:\WINDOWS\system32>activate py37
(py37) C:\WINDOWS\system32>conda install -c conda-forge fbprophet
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
(py37) C:\WINDOWS\system32>python
Python 3.7.11 (default, Jul 27 2021, 09:42:29) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import fbprophet
Importing plotly failed. Interactive plots will not work.
可以发现虚拟自然环境中的确可以正确加装fbprophet,但是导入该库时发掘提示Interactive plots will not work,于是又需要conda install plotly -y来加装plotly库,真是环环相扣,难题百出的两个库。
5.在Anaconda 的python3.7虚拟自然环境加装完fbprophet后,后续需要使用fbprophet时有两个方法:1)cmd里面activate your_environment进入所创建的虚拟自然环境,然后在这个自然环境里面导入fbprophet,但是使用体验不如jupyterlab好;2)可以通过下述操作把新装的虚拟自然环境链接到Jupyter Lab的内核,参考链接如下表所示:
怎样为 jupyter notebook 设置虚拟自然环境? - 知乎 (zhihu.com)
怎样为 jupyter notebook 设置虚拟自然环境?
下面是知乎里介绍的与Jupyter Lab建立连接的必要操作(详尽内容请点击网页链接查看):
先激活自然环境:
conda activate your_env_name
加装Ipykernal:
pip install ipykernel
建立连接:
python -m ipykernel install --user --name your_env_name
查看链接是否成功:
jupyter kernelspec list
6.重启Jupyter Lab,在Jupyter Lab首页的内核选择下拉清单,能看到此前创建的虚拟自然环境,切换到该虚拟自然环境后,就能顺利导入fbprophet。总算可以愉快的玩fbprophet了!
经过两天的搏杀,总算成功装好fbprophet,后续的使用预测过程会一点点的upload到这里,Tks。
原文链接:耗时两日,加装fbprophet_外汇量化__炼丹房的博客-CSDN博客_fbprophet加装