Any help on the following. This didn't happen before the previous update of fbprophet.
Traceback (most recent call last):
File "forecast.py", line 19, in
forecast = m.predict(future)
File "lib/python3.6/site-packages/fbprophet/forecaster.py", line 1138, in predict
intervals = self.predict_uncertainty(df)
File "lib/python3.6/site-packages/fbprophet/forecaster.py", line 1340, in predict_uncertainty
sim_values = self.sample_posterior_predictive(df)
File "lib/python3.6/site-packages/fbprophet/forecaster.py", line 1304, in sample_posterior_predictive
s_m=component_cols['multiplicative_terms'],
File "lib/python3.6/site-packages/fbprophet/forecaster.py", line 1372, in sample_model
Xb_a = np.matmul(seasonal_features.values, beta * s_a) * self.y_scale
File "lib/python3.6/site-packages/pandas/core/series.py", line 648, in __array_wrap__
copy=False).__finalize__(self)
File "lib/python3.6/site-packages/pandas/core/series.py", line 262, in __init__
.format(val=len(data), ind=len(index)))
ValueError: Length of passed values is 3106, index implies 26Process finished with exit code 1
TL;DR Force the use of the following lib version:
pyparsing==2.3.0
tqdm==4.29.0
numpy==1.15.4
I faced the same issue.
I rebuilt a code which tests were working 3 days ago, and today those same test with the same code were failing.
Comparing the build logs, I found that a new version was used for 3 dependencies (pyparsing 2.3.0->2.3.1, tqdm 4.29.0->4.29.1, numpy 1.15.4->1.16.0). I didn't investigated more than that, just forced their version to the one that was automatically downloaded last Friday, and it solved the issue.
Last Numpy version not supported yet. Use 1.15.4.
Should we try to provide more stability, limiting such issues from happening?
I met the same problem. But when I use numpy==1.15.4 and fbprophet==0.4.post1, I met another problem:
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
1 m = Prophet(daily_seasonality=True)
----> 2 m.fit(df)
~/miniconda3/envs/env01/lib/python3.7/site-packages/fbprophet/forecaster.py in fit(self, df, kwargs)
1095 args.update(kwargs)
1096 try:
-> 1097 params = model.optimizing(args)
1098 except RuntimeError:
1099 if 'algorithm' not in args:
~/miniconda3/envs/env01/lib/python3.7/site-packages/pystan/model.py in optimizing(self, data, seed, init, sample_file, algorithm, verbose, as_vector, **kwargs)
509 data = {}
510 seed = pystan.misc._check_seed(seed)
--> 511 fit = self.fit_class(data, seed)
512
513 m_pars = fit._get_param_names()
AttributeError: 'StanModel' object has no attribute 'fit_class'`
I follow this Quick start, and other lib version is pystan==2.18.1.0
SOLVED
I found #599 . After reinstall pystan and fbphrophet, it's all right.
@yohannj @Frans06 @aoliong Thank you Very Much. The error that @aoliong pointed out occurred to me too. Trying the fix of downgrading pystan to 2.18.1.0 and also to 2.17.1.0 didn't work for me.
SOLVED
I found #599 . After reinstall pystan and fbphrophet, it's all right.
Any other leads ? You can check the error below.
venv/bin/python/Syntax/StockAnalyzer/forecast.py
WARNING:pystan:numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
WARNING:pystan:Something went wrong while unpickling the StanModel. Consider recompiling.
ds y
0 2007-11-05 5861.0
1 2007-11-06 5822.1
2 2007-11-07 5762.0
3 2007-11-08 5720.0
4 2007-11-12 5642.5
INFO:fbprophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.
Traceback (most recent call last):
File "StockAnalyzer/forecast.py", line 15, in
m.fit(stock)
File "venv/lib/python3.6/site-packages/fbprophet/forecaster.py", line 1097, in fit
params = model.optimizing(**args)
File "venv/lib/python3.6/site-packages/pystan/model.py", line 511, in optimizing
fit = self.fit_class(data, seed)
AttributeError: 'StanModel' object has no attribute 'fit_class'Process finished with exit code 1
Hey ! I met the same issue. Downgrading numpy to 1.14.5 and fbprophet to 0.3.post2 works for me
Hey ! I met the same issue. Downgrading numpy to 1.14.5 and fbprophet to 0.3.post2 works for me
Thanks that Worked.
_Thanks Everyone for the feedback and help in solving the errors. I am thinking of keeping this thread Open so that we could look up to the dependencies of the packages and their functionality being bugged when upgrading to the latest version of prophet , stan and so on. If you guys suggest otherwise I would close the thread._
I was able to produce this error solely by upgrading numpy from 1.14.5 to 1.16.0
The issue is in the numpy/pandas interface. This code works in numpy 1.15.4 but produces this error in 1.16.0:
import numpy as np
import pandas as pd
X = np.random.rand(5, 2)
beta = np.random.rand(2)
s_a = pd.Series(np.ones(2))
np.matmul(X, beta * s_a)
I'll push a workaround in fbprophet.
The fix has been pushed to pypi. Get the latest version (0.4.post2) with
pip install --upgrade fbprophet
and it is compatible with both old and new versions of numpy.
@bletham Thanks for the bug fix. Have a Great Day.
I'll leave this open for a little bit since other people may run into this as they upgrade numpy, and hopefully will be able to quickly find this as the solution.
I'm using fbprophet on kaggle, i did it today (jan 21), and i'm facing the problem related to this thread subject.
Could anyone help me solving it on kaggle?
@wagner-rodeski, this worked for me (don't forget to turn on the Internet on Kaggle kernel):
!pip3 uninstall --yes fbprophet
!pip3 install fbprophet --no-cache-dir --no-binary :all:
@wagner-rodeski, this worked for me (don't forget to turn on the Internet on Kaggle kernel):
!pip3 uninstall --yes fbprophet !pip3 install fbprophet --no-cache-dir --no-binary :all:
Thanks a lot @grez911 , it's a really useful tip
However, no further adjustment was needed, fbprophet starts working by itself on kaggle's docker afterall
@wagner-rodeski, this worked for me (don't forget to turn on the Internet on Kaggle kernel):
!pip3 uninstall --yes fbprophet !pip3 install fbprophet --no-cache-dir --no-binary :all:Thanks a lot @grez911 , it's a really useful tip
However, no further adjustment was needed, fbprophet starts working by itself on kaggle's docker afterall
So weird - I started a brand new kernel and I'm getting the infamous 26 indexes error.
My "Internet" value is "Internet connected" and I tried copy pasting
"pip3 uninstall --yes fbprophet" into the "pip package name" field" and it returns "Failed"
If I tried "!pip3 uninstall --yes fbprophet", it says "invalid package name".
I'm probably doing something silly.
I am having the same issue
I tried everything you said and I keep on having this error
ValueError Traceback (most recent call last)
<ipython-input-28-6a35f92430e7> in <module>()
1 futur = data_prophet.make_future_dataframe(periods=365 * 2, freq='D')
----> 2 dvlptstaff_forecast = data_prophet.predict(futur)
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in predict(self, df)
1040 't_change': self.changepoints_t,
1041 'X': seasonal_features,
-> 1042 'sigmas': prior_scales,
1043 'tau': self.changepoint_prior_scale,
1044 'trend_indicator': int(self.growth == 'logistic'),
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in predict_uncertainty(self, df)
1242
1243 Parameters
-> 1244 ----------
1245 df: Prediction dataframe.
1246
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in sample_posterior_predictive(self, df)
1206 # Get cumulative rate and offset at each t
1207 k_t = k * np.ones_like(t)
-> 1208 m_t = m * np.ones_like(t)
1209 for s, t_s in enumerate(changepoint_ts):
1210 indx = t >= t_s
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in sample_model(self, df, seasonal_features, iteration, s_a, s_m)
1274 def sample_posterior_predictive(self, df):
1275 """Prophet posterior predictive samples.
-> 1276
1277 Parameters
1278 ----------
/opt/conda/lib/python3.6/site-packages/pandas/core/series.py in __array_wrap__(self, result, context)
646 """
647 return self._constructor(result, index=self.index,
--> 648 copy=False).__finalize__(self)
649
650 def __array_prepare__(self, result, context=None):
/opt/conda/lib/python3.6/site-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
260 'Length of passed values is {val}, '
261 'index implies {ind}'
--> 262 .format(val=len(data), ind=len(index)))
263 except TypeError:
264 pass
ValueError: Length of passed values is 737, index implies 20
@Rym96 can you check that you have version 0.4.post2 installed? In particular, what does
pip show fbprophet
return?
@bletham This is what it shows
Name: fbprophet
Version: 0.3.post2
Summary: Automatic Forecasting Procedure
Home-page: https://facebook.github.io/prophet/
Author: Sean J. Taylor <[email protected]>, Ben Letham <[email protected]>
Author-email: [email protected]
License: BSD
Location: /opt/conda/lib/python3.6/site-packages
Requires: matplotlib, pystan, numpy, pandas, Cython
Required-by:
I updated it to the version 0.4.post2 but still the same issue
`ValueError Traceback (most recent call last)
1 futur = data_prophet.make_future_dataframe(periods= 24, freq='MS')
----> 2 dvlptstaff_forecast = data_prophet.predict(futur)
3 dvlptstaff_forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in predict(self, df)
1040 't_change': self.changepoints_t,
1041 'X': seasonal_features,
-> 1042 'sigmas': prior_scales,
1043 'tau': self.changepoint_prior_scale,
1044 'trend_indicator': int(self.growth == 'logistic'),
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in predict_uncertainty(self, df)
1242
1243 Parameters
-> 1244 ----------
1245 df: Prediction dataframe.
1246
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in sample_posterior_predictive(self, df)
1206 # Get cumulative rate and offset at each t
1207 k_t = k * np.ones_like(t)
-> 1208 m_t = m * np.ones_like(t)
1209 for s, t_s in enumerate(changepoint_ts):
1210 indx = t >= t_s
/opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in sample_model(self, df, seasonal_features, iteration, s_a, s_m)
1274 def sample_posterior_predictive(self, df):
1275 """Prophet posterior predictive samples.
-> 1276
1277 Parameters
1278 ----------
/opt/conda/lib/python3.6/site-packages/pandas/core/series.py in __array_wrap__(self, result, context)
646 """
647 return self._constructor(result, index=self.index,
--> 648 copy=False).__finalize__(self)
649
650 def __array_prepare__(self, result, context=None):
/opt/conda/lib/python3.6/site-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
260 'Length of passed values is {val}, '
261 'index implies {ind}'
--> 262 .format(val=len(data), ind=len(index)))
263 except TypeError:
264 pass
ValueError: Length of passed values is 31, index implies 20鈥媊
Ah, I didn't notice before that you're using conda. In that case you need to make sure that the package you are using in conda is 0.4.post2, which can be different from what system python and pip are using.
Can you in conda do
import fbprophet
print(fbprophet.__version__)
and then try to re-install with conda-forge (which does have 0.4.post2):
conda install -c conda-forge fbprophet
I can only use it if my period is equal to 13
I'm not certain that the version that is actually being loded is 0.4.post2. Could you paste the output of
conda list
and could you also paste the output of
import inspect
from fbprophet import Prophet
print(inspect.getsource(Prophet.sample_model))
@bletham In my case output of conda list is 0.4.post2 but I am still facing this issue.
@anu0012 can you paste the full traceback for the error, like in the post at the top of this issue?
Hey, @bletham Thanks for the reply. But the issue is now solved. I updated it to the latest version.
@bletham Thanks for the reply. I updated fbprophet to 0.5 and it worked.
Most helpful comment
@wagner-rodeski, this worked for me (don't forget to turn on the Internet on Kaggle kernel):