prophet icon indicating copy to clipboard operation
prophet copied to clipboard

StanModel' object has no attribute 'fit_class'

Open iwatts3519 opened this issue 5 years ago • 5 comments

I have tried everything to solve this issue - all of the references I can find online are for older versions of prophet, and are a few years old: I am trying to install using Conda on Windows 10 which the installation instructions suggested was the best way - the first attempt failed until I installed GCC (version 5.3.0) - then it installed. Windows Version is 10.0.19043 I meet all of the requirements here - https://github.com/facebook/prophet/blob/master/python/requirements.txt I have used the following line to install: conda install -c conda-forge prophet

And I still get the following error - this seemed quite common a few years ago but I cannot find any recent comments about it:

WARNING:pystan:No module named 'stanfit4anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec_4959769199373391054' WARNING:pystan:Something went wrong while unpickling the StanModel. Consider recompiling. INFO:prophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this. Traceback (most recent call last): File "C:\Users\iwatt\Coding\prophet\main.py", line 12, in <module> m.fit(df) # Fit the Prophet model. File "C:\Users\iwatt\Coding\prophet\env\lib\site-packages\prophet\forecaster.py", line 1171, in fit self.params = self.stan_backend.fit(stan_init, dat, **kwargs) File "C:\Users\iwatt\Coding\prophet\env\lib\site-packages\prophet\models.py", line 264, in fit self.stan_fit = self.model.optimizing(**args) File "C:\Users\iwatt\Coding\prophet\env\lib\site-packages\pystan\model.py", line 542, in optimizing fit = self.fit_class(data, seed) AttributeError: 'StanModel' object has no attribute 'fit_class'

Can anyone help?

iwatts3519 avatar Aug 15 '21 13:08 iwatts3519

I am having the same issure on macOS and a linux cluster. Py version 3.9.6 Could it be a python version issue or permissions issue? None of the solutions online have worked for me

kentkr avatar Aug 26 '21 16:08 kentkr

I had similar problems on Linux trying to install the latest version.

What worked for me was to use Python 3.8 and use conda install -c conda-forge fbprophet (version 0.7.1) instead of prophet.

hansukyang avatar Aug 26 '21 16:08 hansukyang

at first glance, python 3.7.6 with prophet 1.0.1 works

kentkr avatar Aug 26 '21 16:08 kentkr

I am getting the same error AttributeError: 'StanModel' object has no attribute 'fit_class' with Prophet v1.0.1 (installed with conda install -c conda-forge prophet) since several months. Downgrading Python version to =< v3.8.8 solves the problem.

However I would like to switch to a more recent Python version, say v3.9.5, all other libraries that I use support it. One solution that seems to work is to build the Prophet library from the source, but I am not sure to do it properly. It would be much cleaner to install it directly from conda/pip.

vlccnt avatar Sep 02 '21 13:09 vlccnt

Fbprophet is not compatible with Python 3.9.x yet. You need to use any older versions such as 3.8.x. Also, try to run the script as admin.

alexbourg avatar Sep 09 '21 03:09 alexbourg