Repository: sktime/sktime

Issue:
[BUG] Use prophet instead of fbprophet in requirements
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->

Posted in :

> I think we need to switch over to the prophet package as opposed to fbprophet. I think the problem is that fbprophet is quite old and they list pystan>=2.14 as a requirement. This causes pystan 3.2.0 to be installed which is actually not compatible with prophet! Prophet only supports pystan 2. prophet has the correct pin of pystan~=2.19.1.1.

You can repro this like follow:
- Download the fbprophet tar ball [here](https://pypi.org/project/fbprophet/#files)
- Open `requirements.txt`

You should see the following:
```
Cython>=0.22
cmdstanpy==0.9.5
pystan>=2.14
numpy>=1.15.4
pandas>=1.0.4
matplotlib>=2.0.0
LunarCalendar>=0.0.9
convertdate>=2.1.2
holidays>=0.10.2
setuptools-git>=1.2
python-dateutil>=2.8.0
tqdm>=4.36.1
```

`pystan>=2.14` will install the latest pystan ([pystan 3](https://pypi.org/project/pystan/)). However, Prophet does not support [pystan 3](https://github.com/facebook/prophet#installation-in-python)!!

I suspect this is making our build more complicated than it needs to be.


<!-- Thanks for contributing! -->



Discussion:
Filed this to hopefully remove fbprophet from package repositories:  https://github.com/facebook/prophet/issues/2074
Hi, I tried out what @freddyaboulton suggested. My `build_tools/requirements.txt` does not look like the one posted above (see down here). To reproduce this, I did the following:

* Created a `conda` environment named `sktime` with Python 3.8 and `pip`
* Followed the steps [here](https://www.sktime.org/en/latest/get_involved/contributing.html#git-and-github-workflow)
* In the `build_tools/requirements.txt` as follows, changed `fbprophet>=0.7.1` to `prophet>=1.0.0`. 
* Ran `pip install -r build_tools/requirements.txt`

The first time it tried to install `prophet` it failed, then installed `numpy` and then `pip` successfully installed `prophet` again. Note: in this way, the `pystan` version installed is `pystan-2.19.1.1`.

```
cython>=0.29.0
deprecated>=1.2.13
dtw_python>=1.1.5
esig==0.9.7
fbprophet>=0.7.1 --> prophet>=1.0.0
hcrystalball>=0.1.9
numba==0.53
numpy==1.19.3
pandas==1.1.5
pmdarima>=1.8.0,!=1.8.1
pyod>=0.8.0
pystan>=2.14,<3.0
pytest
pytest-cov
scikit-learn==0.24.*
scikit-posthocs
statsmodels==0.12.1
stumpy>=1.5.1,<=1.9.2
tbats>=1.1.0
tsfresh>=0.17.0
wheel
```

Another notice: folks at darts use [these requirements](https://github.com/unit8co/darts/blob/master/requirements/prophet.txt) for prophet:

```
prophet>=1.0.0
pystan>=2.19.1.1,<3.0.0.0
```

Will try them as soon as I can, in theory they should work - as I noted above:

> Note: in this way, the pystan version installed is pystan-2.19.1.1.

Guess I will use these when I prepare the PR.

(A side mention: why is `pandas` frozen at 1.15?)

Resolving patch:
diff --git a/build_tools/azure/check_soft_dependencies.py b/build_tools/azure/check_soft_dependencies.py
--- a/build_tools/azure/check_soft_dependencies.py
+++ b/build_tools/azure/check_soft_dependencies.py
@@ -18,12 +18,12 @@
 SOFT_DEPENDENCIES = {
     "sktime.benchmarking.evaluation": ["matplotlib"],
     "sktime.benchmarking.experiments": ["tsfresh", "esig"],
-    "sktime.forecasting.all": ["pmdarima", "fbprophet", "tbats"],
+    "sktime.forecasting.all": ["pmdarima", "prophet", "tbats"],
     "sktime.forecasting.arima": ["pmdarima"],
     "sktime.forecasting.hcrystalball": ["hcrystalball"],
     "sktime.forecasting.tbats": ["tbats"],
     "sktime.forecasting.bats": ["tbats"],
-    "sktime.forecasting.fbprophet": ["fbprophet"],
+    "sktime.forecasting.fbprophet": ["prophet"],
     "sktime.classification.feature_based": ["tsfresh", "esig"],
     "sktime.transformations.panel.tsfresh": ["tsfresh"],
     "sktime.transformations.series.matrix_profile": ["stumpy"],
diff --git a/sktime/forecasting/base/adapters/_fbprophet.py b/sktime/forecasting/base/adapters/_fbprophet.py
--- a/sktime/forecasting/base/adapters/_fbprophet.py
+++ b/sktime/forecasting/base/adapters/_fbprophet.py
@@ -15,7 +15,7 @@
 
 
 class _ProphetAdapter(BaseForecaster):
-    """Base class for interfacing fbprophet and neuralprophet."""
+    """Base class for interfacing prophet and neuralprophet."""
 
     _tags = {
         "ignores-exogeneous-X": False,
@@ -252,7 +252,7 @@ def _merge_X(df, X):
     if "ds" in X.columns and pd.api.types.is_numeric_dtype(X["ds"]):
         longest_column_name = max(X.columns, key=len)
         X.loc[:, str(longest_column_name) + "_"] = X.loc[:, "ds"]
-        # raise ValueError("Column name 'ds' is reserved in fbprophet")
+        # raise ValueError("Column name 'ds' is reserved in prophet")
     X.loc[:, "ds"] = X.index
     df = df.merge(X, how="inner", on="ds", copy=True)
     X = X.drop(columns="ds")
diff --git a/sktime/forecasting/fbprophet.py b/sktime/forecasting/fbprophet.py
--- a/sktime/forecasting/fbprophet.py
+++ b/sktime/forecasting/fbprophet.py
@@ -11,7 +11,7 @@
 from sktime.forecasting.base.adapters import _ProphetAdapter
 from sktime.utils.validation._dependencies import _check_soft_dependencies
 
-_check_soft_dependencies("fbprophet")
+_check_soft_dependencies("prophet")
 
 
 class Prophet(_ProphetAdapter):
@@ -167,7 +167,7 @@ def __init__(
         self.interval_width = interval_width
 
         # import inside method to avoid hard dependency
-        from fbprophet.forecaster import Prophet as _Prophet
+        from prophet.forecaster import Prophet as _Prophet
 
         self._ModelClass = _Prophet
 


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -72,7 +72,7 @@ jobs:
       - name: Install conda dependencies
         run: |
           conda install -c anaconda "pystan==2.19.1.1"
-          conda install -c conda-forge "fbprophet>=0.7.1"
+          conda install -c conda-forge "prophet>=1.0"
           conda install -c conda-forge scipy matplotlib
 
       - name: Install sktime and dependencies