I encountered the following problem when using Facebook prophet:
The code is as follows:
from prophet import Prophet
model = Prophet()
The following error is reported when executing the program:
File "D:\Python\Python38\lib\site-packages\prophet\forecaster.py", line 156, in _load_stan_backend
logger.debug("Loaded stan backend: %s", self.stan_backend.get_type())
AttributeError: 'Prophet' object has no attribute 'stan_backend'
The running environment is windows server 2019, python3.8.
Package Version
------------------- ----------
APScheduler 3.10.1
backports.zoneinfo 0.2.1
certifi 2023.5.7
charset-normalizer 2.0.12
cmdstanpy 1.1.0
colorama 0.4.6
convertdate 2.4.0
cycler 0.11.0
ephem 4.1.4
greenlet 2.0.2
h5py 3.8.0
holidays 0.28
idna 3.4
imageio 2.31.1
importlib-metadata 4.11.3
importlib-resources 5.12.0
joblib 1.1.0
kiwisolver 1.4.4
loguru 0.7.0
LunarCalendar 0.0.9
matplotlib 3.4.3
networkx 3.1
numpy 1.22.4+mkl
packaging 23.1
pandas 1.4.3
Pillow 8.4.0
pip 21.1.1
prophet 1.1.4
PyMeeus 0.5.12
pyparsing 3.1.0
python-dateutil 2.8.2
pytz 2022.1
PyWavelets 1.4.1
scikit-image 0.19.2
scikit-learn 1.1.1
scipy 1.7.3
setuptools 56.0.0
six 1.16.0
threadpoolctl 3.1.0
tifffile 2023.7.4
tqdm 4.65.0
tzdata 2023.3
tzlocal 5.0.1
urllib3 1.26.16
win32-setctime 1.1.0
zipp 3.15.
This error is in python. The facebook prophet object does not have the "stan_backend" attribute. It is usually caused by the stan backend not being installed correctly when installing prophet. The solution is to install pystan:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pystan==2.19.1.1
My operation is to uninstall cmdstanpy and prophet first:
pip uninstall cmdstanpy
pip uninstall prophet
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pystan==2.19.1.1
pip install -i https:// pypi.tuna.tsinghua.edu.cn/simple prophet
Reference: https://github.com/facebook/prophet/issues/1835
Just adding my two cents to this issue:
The documentation mentions that we need to install a specific version of PyStan, so be mindful of this.
pip install pystan==2.19.1.1
After installing this it started working for me
It's strange. My development environment is Windows 10 Professional Edition, and there is no problem in the same installation environment. why?
I don't have pyspan installed on my computer, and there is no problem. Why? Feedback welcome, thank you!