【24.5.10更新】
环境配置好后尽量不要在下载其他包了,本人下载了xgboost包后,再运行fbprophet,又把holidays、numpy、pandas的版本重新更新了一遍
1.解决conda命令报错Error loading anaconda_anon_usage: No module named ‘anaconda_anon_usage’
【避雷】直接安装报错后,看网上其他方法说要更新conda,结果差点把我的anaconda环境搞崩溃。
运行所有的conda命令都报下面的错误
Error loading anaconda_anon_usage: No module named 'anaconda_anon_usage'
网上关于这个问题的解决方法很少,自己摸索了以下方法
在https://github.com/anaconda/anaconda-anon-usage重新下载’anaconda_anon_usage’,解压后用pycharm打开,在终端运行setup.py文件
Python setup.py install
再运行conda命令就不报该错误了。
2.fbprophet包安装
https://blog.csdn.net/m0_74854947/article/details/134106899
创建虚拟环境的时候又出现CondaHTTPError: HTTP 429 TOO MANY REQUESTS for url的问题,采用离线模式创建并激活完成代码如下
conda config --set offline true
但到了安装py3.8时又出现上述报错,采用该文章下的方法解决https://blog.csdn.net/qq_43128256/article/details/137112501
3.运行时遇到的错误
至此prophet包已经下载完成,可以运行简单的代码来测试是否可用,我用的是下面这篇文章的代码,数据自己造的(注意列名必须是ds和y)
https://blog.csdn.net/SeafyLiang/article/details/121780934
3.1 holidays错误
TypeError: This is a python-holidays entity loader class. For entity inheritance purposes please import a class you want to derive from directly: e.g., `from holidays.countries import Entity` or `from holidays.financial import Entity`.
看网上教程让卸载holidays,安装0.17.2版本,结果一装又报错
PackagesNotFoundError: The following packages are not available from current channels: - holidays==0.17.2
Anaconda.org也搜不到该版本的holidays,最后使pip安装成功,
pip install holidays==0.17.2
但同时又提示有两个fbprophet依赖的包没装上,同样用pip安装完成
3.2 plotly错误
运行代码后又报无plotly错误,
安装plotly
pip install plotly
3.3 numpy错误
继续报错,numpy无float属性
原因是numpy版本太新,numpy1.24起删除了numpy.bool、numpy.int、numpy.float、numpy.complex、numpy.object、numpy.str、numpy.long、numpy.unicode类型的支持。所以卸载numpy后安装1.23.5版本的numpy
pip install numpy==1.23.5
又提示需要 typing-extensions<4,>=3.7.4.3
继续安装
pip install typing-extensions==3.7.4.3
3.4 pandas错误
解决完numpy的问题后,又出现pandas的错误
AttributeError: 'DataFrame' object has no attribute 'append'
与numpy问题一样,同样需要降低pandas版本
pip uninstall pandas
pip install pandas==1.5.3
终于可以运行了!