Prophet: holidays 0.9.9 breaks fbprophet

Created on 3 Jan 2019  路  6Comments  路  Source: facebook/prophet

holidays=0.9.8 works and when upgrading to holidays=0.9.9, it fails with the following stacktrace:

  File "/my_project/src/models/train_model.py", line 3, in <module>
    import fbprophet
  File "/my_project/venv/lib/python3.7/site-packages/fbprophet/__init__.py", line 8, in <module>
    from fbprophet.forecaster import Prophet
  File "/my_project/venv/lib/python3.7/site-packages/fbprophet/forecaster.py", line 23, in <module>
    from fbprophet.make_holidays import get_holiday_names, make_holidays_df
  File "/my_project/venv/lib/python3.7/site-packages/fbprophet/make_holidays.py", line 17, in <module>
    import fbprophet.hdays as hdays_part2
  File "/my_project/venv/lib/python3.7/site-packages/fbprophet/hdays.py", line 13, in <module>
    from holidays import HolidayBase, MONDAY, WEEKEND, rd, easter
ImportError: cannot import name 'MONDAY' from 'holidays' (/my_project/venv/lib/python3.7/site-packages/holidays.py)

Most helpful comment

To circumvent it, either you wait for https://github.com/facebook/prophet/pull/791 to be merged,
Or you force the holidays package to use a version that doesn't break prophet:

pip install holidays==0.9.8 fbprophet

All 6 comments

the new holidays version was released 3 hours ago https://pypi.org/project/holidays/#history

Hi!
I just installed Prophet, however, when I type:
from fbprophet import Prophet
I got this error:
ImportError: cannot import name 'MONDAY'
I ran: pip install fbprophet --upgrade before asking the question, and even with that I got the same error.
I can not even execute:
import fbprophet
fbprophet.__version__
As I get the same ImportError: cannot import name 'MONDAY'...
I believe this error is related to louisguitton`s comments, so any suggestion on how to overcome this error, would be extremelly welcome...

i am getting the same error:

Traceback (most recent call last):
File "Daily_Dashboard.py", line 291, in
temp_series = get_forecast(i,kind)
File "Daily_Dashboard.py", line 192, in get_forecast
from fbprophet import Prophet
File "/usr/local/lib/python2.7/site-packages/fbprophet/__init__.py", line 8, in
from fbprophet.forecaster import Prophet
File "/usr/local/lib/python2.7/site-packages/fbprophet/forecaster.py", line 23, in
from fbprophet.make_holidays import get_holiday_names, make_holidays_df
File "/usr/local/lib/python2.7/site-packages/fbprophet/make_holidays.py", line 17, in
import fbprophet.hdays as hdays_part2
File "/usr/local/lib/python2.7/site-packages/fbprophet/hdays.py", line 13, in
from holidays import HolidayBase, MONDAY, WEEKEND, rd, easter
ImportError: cannot import name MONDAY

To circumvent it, either you wait for https://github.com/facebook/prophet/pull/791 to be merged,
Or you force the holidays package to use a version that doesn't break prophet:

pip install holidays==0.9.8 fbprophet

I suppose alternatively, you could download my PR branch and rebuild and install prophet from source. But that might be more trouble than its worth.

Was this page helpful?
0 / 5 - 0 ratings