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.03k stars 4.48k forks source link

AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.. Did you mean: 'float16'? #2595

Open jianboy opened 5 days ago

jianboy commented 5 days ago
    from prophet import Prophet
  File "/opt/python/3.12.1/lib/python3.12/site-packages/prophet/__init__.py", line 7, in <module>
    from prophet.forecaster import Prophet
  File "/opt/python/3.12.1/lib/python3.12/site-packages/prophet/forecaster.py", line 28, in <module>
    class Prophet(object):
  File "/opt/python/3.12.1/lib/python3.12/site-packages/prophet/forecaster.py", line 459, in Prophet
    ) -> NDArray[np.float_]:
                 ^^^^^^^^^
  File "/opt/python/3.12.1/lib/python3.12/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.. Did you mean: 'float16'?

can not import prophet

version:

Requirement already satisfied: prophet in /opt/python/3.12.1/lib/python3.12/site-packages (1.1.5)
Requirement already satisfied: pandas in /opt/python/3.12.1/lib/python3.12/site-packages (2.2.2)
Requirement already satisfied: numpy in /opt/python/3.12.1/lib/python3.12/site-packages (2.0.0)
mrogocki commented 4 days ago

Hello,

I solved this issue for myself to replace the np.float_ with the suggestes np.float64 instead.

File prophet/forecaster.py @staticmethod def fourier_series( dates: pd.Series, period: Union[int, float], series_order: int, ) -> NDArray[~~np.float_~~ -> np.float64]: It would be then necessary to add numpy>=2.0.X in the requirements. Would this solve #2595?

mrogocki commented 4 days ago

Also duplicate with #2588 in my opinion :)