facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.39k stars 4.53k forks source link

Error when importing prophet #2442

Open vipresutti opened 1 year ago

vipresutti commented 1 year ago

Full error code below


TypeError Traceback (most recent call last) Cell In[1], line 27 24 from sklearn.metrics import classification_report 25 from sklearn.metrics import confusion_matrix ---> 27 from prophet import Prophet

File ~\AppData\Local\anaconda3\lib\site-packages\prophet__init__.py:7 1 # Copyright (c) 2017-present, Facebook, Inc. 2 # All rights reserved. 3 # 4 # This source code is licensed under the BSD-style license found in the 5 # LICENSE file in the root directory of this source tree. An additional grant 6 # of patent rights can be found in the PATENTS file in the same directory. ----> 7 from prophet.forecaster import Prophet 9 from pathlib import Path 10 about = {}

File ~\AppData\Local\anaconda3\lib\site-packages\prophet\forecaster.py:19 16 import pandas as pd 17 from numpy.typing import NDArray ---> 19 from prophet.make_holidays import get_holiday_names, make_holidays_df 20 from prophet.models import StanBackendEnum 21 from prophet.plot import (plot, plot_components)

File ~\AppData\Local\anaconda3\lib\site-packages\prophet\make_holidays.py:14 11 import numpy as np 12 import pandas as pd ---> 14 import prophet.hdays as hdays_part2 15 import holidays as hdays_part1 18 def get_holiday_names(country):

File ~\AppData\Local\anaconda3\lib\site-packages\prophet\hdays.py:779 771 pass 774 # ------------ Holidays in Turkey--------------------- 775 # This is now in Holidays, but with alias TR instead of the TU that we used. 776 # Include TU as an alias for backwards compatibility. --> 779 class TU(Turkey): 780 pass 783 # ------------ Holidays in Pakistan---------------------

File ~\AppData\Local\anaconda3\lib\site-packages\holidays\registry.py:178, in EntityLoader.init(self, path, *args, *kwargs) 175 self.entity_name = entity_path[-1] 176 self.module_name = ".".join(entity_path[0:-1]) --> 178 super().init(args, **kwargs)

TypeError: object.init() takes exactly one argument (the instance to initialize)

ngerald commented 1 year ago

This is a known issue with the holidays package v0.25: https://github.com/dr-prodigy/python-holidays/issues/1200

Prophet doesn't explicitly state which version to use, so it defaults to the latest version on installation. You should be able to get around this by manually downgrading the holidays package to v0.24