Dexter
Dexter

Reputation: 91

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

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.

Upvotes: 6

Views: 5365

Answers (3)

bakunet
bakunet

Reputation: 631

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

Upvotes: 0

wordsforthewise
wordsforthewise

Reputation: 15807

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

Upvotes: 0

Brian Ho
Brian Ho

Reputation: 31

uninstall fbprophet and pystan, then:

pip install pystan==2.19.1.1
pip install prophet

and

from prophet import Prophet

Upvotes: 3

Related Questions