Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The fit method do not work with pystan==2.17.0.0 #324

Closed
robsonpeixoto opened this issue Oct 9, 2017 · 8 comments
Closed

The fit method do not work with pystan==2.17.0.0 #324

robsonpeixoto opened this issue Oct 9, 2017 · 8 comments
Labels
Milestone

Comments

@robsonpeixoto
Copy link

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-0235c1cd9218> in <module>()
----> 1 m.fit(serie);

~/.pyenv/versions/3.6.2/envs/manhattan/lib/python3.6/site-packages/fbprophet/forecaster.py in fit(self, df, **kwargs)
    832             try:
    833                 params = model.optimizing(
--> 834                     dat, init=stan_init, iter=1e4, **kwargs)
    835             except RuntimeError:
    836                 params = model.optimizing(

~/.pyenv/versions/3.6.2/envs/manhattan/lib/python3.6/site-packages/pystan/model.py in optimizing(self, data, seed, init, sample_file, algorithm, verbose, as_vector, **kwargs)
    470             data = {}
    471         seed = pystan.misc._check_seed(seed)
--> 472         fit = self.fit_class(data, seed)
    473 
    474         m_pars = fit._get_param_names()

stanfit4anon_model_1fdd477dd8bcc50395c4e25c8741f1c1_7672185744958054027.pyx in stanfit4anon_model_1fdd477dd8bcc50395c4e25c8741f1c1_7672185744958054027.StanFit4Model.__init__()

TypeError: __init__() takes exactly 1 positional argument (2 given)

@bletham
Copy link
Contributor

bletham commented Oct 11, 2017

Thanks for the heads up on this. When fbprophet is installed, the models are compiled in stan and saved in a pickle. The issue here seems to be in loading the models pickled under an older version of pystan in the newer version of pystan. I was able to replicate this issue, and found that it was fixed by re-intsalling fbprophet:

sudo pip3 install -U fbprophet

Unit tests pass under the new Stan version.

@robsonpeixoto
Copy link
Author

Thanks a lot, @bletham. Maybe a troubleshooting section with this info will help a lot.

@dbricare
Copy link

dbricare commented Oct 16, 2017

Received this same error on my system with fbprophet updated from 0.1.1 to 0.2, and python 3.5 while using jupyter. Running sudo pip3 install -U fbprophet didn't resolve the issue for me. I found two possible workarounds though.

  • Keep the existing fbprophet 0.2 install and rollback pystan 2.17 to 2.14:
sudo -H pip3 install -U pystan==2.14

Or

  • Uninstall fbprophet 0.2, delete the cached wheel, install pystan 2.17, then reinstall fbprophet with pip:
sudo -H pip3 uninstall fbprophet pystan
sudo rm /path/to/fbprophet*.whl
sudo -H pip3 install pystan==2.17
sudo -H pip3 install fbprophet==0.2

Haven't tested this thoroughly but the fit error did go away.

@bletham
Copy link
Contributor

bletham commented Oct 17, 2017

Thanks @dbricare , that makes sense, the cached wheel would also contain the models compiled under the old pystan version. I think that pip3 --no-cache-dir install fbprophet would work, although removing the wheel seems like a better option.

@jcrodrigue
Copy link

Great success with this under anaconda Python 2.7. Thank you @bletham

sudo pip install -U fbprophet

@tsuresh83
Copy link

tsuresh83 commented Oct 27, 2017

I installed prophet 0.2 using conda, pystan version 2.14 under python 3.6. I get the following error:
'init() takes exactly 2 positional arguments (1 given)'

@kirankunapuli
Copy link

I received the same error TypeError: __init__() takes exactly 1 positional argument (2 given) and pip install -U fbprophet didn't resolve the issue under Python 3.6.3 :: Anaconda, Inc. but introduced a Cython error!

I used the following commands to finally get it working,

pip uninstall fbprophet pystan
pip --no-cache-dir install pystan==2.17
pip --no-cache-dir install fbprophet==0.2
conda install Cython --force

@bletham
Copy link
Contributor

bletham commented Jun 7, 2018

I added to the install directions that fbprophet may need to be re-installed after upgrading pystan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants