There seems to be an error in using the prophet library in streamlit

Summary

There seems to be an error in using the prophet library in streamlit.

Steps to reproduce

Code snippet:

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script

    exec(code, module.__dict__)

  File "/app/project2/app.py", line 18, in <module>

    from predict import run_predict

  File "/app/project2/predict.py", line 16, in <module>

    from ml2 import prediction2

  File "/app/project2/ml2.py", line 13, in <module>

    import prophet

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/__init__.py", line 7, in <module>

    from prophet.forecaster import Prophet

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/forecaster.py", line 19, in <module>

    from prophet.make_holidays import get_holiday_names, make_holidays_df

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/make_holidays.py", line 14, in <module>

    import prophet.hdays as hdays_part2

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/hdays.py", line 779, in <module>

    class TU(Turkey):

  File "/home/appuser/venv/lib/python3.9/site-packages/holidays/registry.py", line 178, in __init__

    super().__init__(*args, **kwargs)

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

2023-05-17 05:51:09.985 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script

    exec(code, module.__dict__)

  File "/app/project2/app.py", line 18, in <module>

    from predict import run_predict

  File "/app/project2/predict.py", line 16, in <module>

    from ml2 import prediction2

  File "/app/project2/ml2.py", line 13, in <module>

    import prophet

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/__init__.py", line 7, in <module>

    from prophet.forecaster import Prophet

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/forecaster.py", line 19, in <module>

    from prophet.make_holidays import get_holiday_names, make_holidays_df

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/make_holidays.py", line 14, in <module>

    import prophet.hdays as hdays_part2

  File "/home/appuser/venv/lib/python3.9/site-packages/prophet/hdays.py", line 779, in <module>

    class TU(Turkey):

  File "/home/appuser/venv/lib/python3.9/site-packages/holidays/registry.py", line 178, in __init__

    super().__init__(*args, **kwargs)

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

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

Additional information

If needed, add any other context about the problem here.

@xmcmrb downgrade the package for holidays either:

  • on your local machine in cmd type: pip install holidays==0.24
  • in requirements.txt change prophet / holiday packages to stable versions:
    holidays==0.24
    prophet==1.1.2

found solution on: Cannot import prophet Β· Issue #2432 Β· facebook/prophet Β· GitHub

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.