'StanModel' object has no attribute 'fit_class' while using Prophet
Asked Answered
B

3

6

I am trying to use prophet. I have installed all required packages:

pip install pandas numpy jupyterlab seaborn 
conda install pywin32 
conda install -c anaconda pystan=2.19.1.1=py38hac22706_0
conda install -c conda-forge prophet 
conda install -c conda-forge tensorflow 
pip install darts 
conda install -c conda-forge prophet

Why pystan=2.19.1.1=py38hac22706_0? Because someone has this version and everything works well, so he sugested this version. The same Windows system, the same order of installing packages. But I got an error 'StanModel' object has no attribute 'fit_class' while fitting the model :

model = Prophet()
model.fit(train)
prediction = model.predict(len(val))

I checked whether I really have Pystan and I really have it.

Please help.

Bloomington answered 3/6, 2021 at 11:43 Comment(0)
K
3

uninstall fbprophet and pystan, then:

pip install pystan==2.19.1.1
pip install prophet

and

from prophet import Prophet
Kane answered 14/7, 2021 at 1:47 Comment(0)
F
0

This happened to me after installing prophet while running a jupyter notebook. I simply restarted the kernel and it worked after that.

Farce answered 25/9, 2021 at 20:8 Comment(0)
S
0

As far as I know, for pystan==1.0.1 and pystan==2.19.1.1

error

'StanModel' object has no attribute 'fit_class'

Can be caused by pystan version lower than 3.0.0. Installing it on Windows machine can be problematic because of httpstan package.

As per documentation httpstan versions higher than 1.0.0 do not support Windows:

Requirements

Python version 3.7 or higher.
macOS or Linux.
C++ compiler: gcc ≥9.0 or clang ≥10.0.

Only solutions I found for now is to use Docker or VM. Windows also has WSL

Shaddock answered 25/12, 2021 at 23:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.