'StanModel' object has no attribute 'fit_class' while using Prophet

5.1k Views Asked by At

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.

3

There are 3 best solutions below

0
On

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

0
On

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

0
On

uninstall fbprophet and pystan, then:

pip install pystan==2.19.1.1
pip install prophet

and

from prophet import Prophet