Prophet: ImportError: cannot import name 'MONDAY'

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

Hello guys,
I am experiencing problem installing fbprophet.
Here's my setup:

Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic

Python version: 3.7.0

pip packages:

convertdate==2.1.3
cycler==0.10.0
Cython==0.29.2
ephem==3.7.6.0
fbprophet==0.4
holidays==0.9.9
kiwisolver==1.0.1
lunardate==0.2.0
matplotlib==3.0.2
numpy==1.15.4
pandas==0.23.4
pyparsing==2.3.0
pystan==2.18.1.0
python-dateutil==2.7.5
pytz==2018.7
six==1.12.0

Error detail:

[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
i>>> import fbprophet
WARNING:pystan:No module named 'stanfit4anon_model_861b75c6337e237650a61ae58c4385ef_2841341000846931969'
WARNING:pystan:Something went wrong while unpickling the StanModel. Consider recompiling.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/robomotic/.pyenv/versions/marketai-3.7.0/lib/python3.7/site-packages/fbprophet/__init__.py", line 8, in <module>
    from fbprophet.forecaster import Prophet
  File "/home/robomotic/.pyenv/versions/marketai-3.7.0/lib/python3.7/site-packages/fbprophet/forecaster.py", line 23, in <module>
    from fbprophet.make_holidays import get_holiday_names, make_holidays_df
  File "/home/robomotic/.pyenv/versions/marketai-3.7.0/lib/python3.7/site-packages/fbprophet/make_holidays.py", line 17, in <module>
    import fbprophet.hdays as hdays_part2
  File "/home/robomotic/.pyenv/versions/marketai-3.7.0/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' (/home/robomotic/.pyenv/versions/marketai-3.7.0/lib/python3.7/site-packages/holidays.py)

Two questions:
1) can the warning signal be ignored?
2) seems like the correct import should MON and not MONDAY

Cheers.

bug ready

Most helpful comment

Same error here. I got it working by downgrading the holidays package:

pip install holidays==0.9.8

The error is caused by this change: https://github.com/dr-prodigy/python-holidays/commit/1a1805285d0eabce3b8eb7feed5c1f48e2435bf9
introduced in the tag 0.9.9

All 6 comments

Same probleme here, I did do a small workaround and it was fixed:

/fbprophet/hdays.py
changing as you said
"from holidays import HolidayBase, MONDAY, WEEKEND, rd, easter"
=>
"from holidays import HolidayBase, MON as MONDAY, WEEKEND, rd, easter"

@OliverZachau do you also get the same warning as me, does everything works as expected?

Same error here. I got it working by downgrading the holidays package:

pip install holidays==0.9.8

The error is caused by this change: https://github.com/dr-prodigy/python-holidays/commit/1a1805285d0eabce3b8eb7feed5c1f48e2435bf9
introduced in the tag 0.9.9

Thanks for reporting this.
The No module named 'stanfit4anon_model_861b75c6337e237650a61ae58c4385ef_2841341000846931969' is from a mistake we made when putting the most recent version on PyPI. It's described in #775. The issue is now fixed in PyPI, but you'll have to reinstall with pip --no-cache.

@Kryniol thanks for pointing out the change in the holidays package, the timing of that change was very unfortunate. We'll push out a fix ASAP that will set a version requirement for holidays, but in the meantime downgrading as described will work.

Fix is in #791 from @Gordonei (https://github.com/facebook/prophet/commit/aebe8da78dc6cdf898fe5eee5540f0094f870ac8)

The fixed has been pushed to pypi.

pip install --upgrade fbprophet

will resolve the issue.

Was this page helpful?
0 / 5 - 0 ratings