1

I have even used this command conda install -c conda-forge prophet and even tried to pip uninstall pystan, prophet and installed again. But, still facing this issue.

AttributeError                            Traceback (most recent call last)
<ipython-input-18-70a8fe714d7e> in <module>
----> 1 model = Prophet()

~\anaconda3\lib\site-packages\prophet\forecaster.py in __init__(self, growth, changepoints, n_changepoints, changepoint_range, yearly_seasonality, weekly_seasonality, daily_seasonality, holidays, seasonality_mode, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, stan_backend)
    139         self.fit_kwargs = {}
    140         self.validate_inputs()
--> 141         self._load_stan_backend(stan_backend)
    142 
    143     def _load_stan_backend(self, stan_backend):

~\anaconda3\lib\site-packages\prophet\forecaster.py in _load_stan_backend(self, stan_backend)
    152             self.stan_backend = StanBackendEnum.get_backend_class(stan_backend)()
    153 
--> 154         logger.debug("Loaded stan backend: %s", self.stan_backend.get_type())
    155 
    156     def validate_inputs(self):

AttributeError: 'Prophet' object has no attribute 'stan_backend'
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
Sameer
  • 103
  • 2
  • 10

2 Answers2

4

This is happening because you are installing latest version of pystan which is not supported yet by prophet. You need to do pip install pystan==2.19.1.1 or conda install -c conda-forge pystan=2.19.1.1 and then install prophet.

See prophet installation instructions and this github issue for more reference on your issue.

avats
  • 437
  • 2
  • 10
0

I have been going through the same issue, even after installing pystan=2.19.1.1 and then installing prophet. But my issue was resolved with the following steps.

  1. use CMDSTANPY as stan_backend. Reference here

  2. Install cmdstn using this reference here

  3. Install the following commands(centos)

    yum install gcc gcc-c++ make wget ca-certificates tar gzip -y
    wget --progress=dot:mega https://github.com/stan-dev/cmdstan/releases/download/v2.27.0/cmdstan-2.27.0.tar.gz
    tar -zxvf cmdstan-2.27.0.tar.gz
    ln -s cmdstan-2.27.0 cmdstan
    cd cmdstan; make build
    cd cmdstan; echo "CmdStan home directory is" $PWD
    CMDSTAN=/var/task/cmdstan STAN_BACKEND=CMDSTANPY pip install prophet
    
    

Now you will be able to run Prophet properly without any errors. I hope this answer helps everyone who is struggling with this issue.

ahmed sharief
  • 83
  • 2
  • 13