pythonfacebook-prophet

How do I correctly import the Prophet module?


I'm trying to install the FBProphet module on my MacOS 10.15.5 with Python 3.10.10. After succesfully installing the package through pip I tried importing the module (from prophet import Prophet) but was struck with this error message:

TypeError                                 Traceback (most recent call last)
Cell In[4], line 2
      1 #Trying the FP Prophet model on the data
----> 2 from prophet import Prophet

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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 /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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 /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prophet/make_holidays.py:14
...
    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)```

Does anyone understand why this happens and how to fix this? 

Solution

  • I found a solution form a chineese website:

    pip install holidays==0.24
    

    the 0.25 version makes the error append.

    tested on: ubuntu 22.04, python 3.10.4, pip 23.1.2, prophet 1.1.2

    opened issue: https://github.com/facebook/prophet/issues/2432