-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Context
Pystan 3+ makes some breaking changes to Prophet python package:
- MAP estimation is removed.
- Windows support is removed.
We've been continuing to use Pystan 2.19.1.1, but this is only supported up to Python 3.8 and no longer receives development. Many of our issues also relate to pystan issues, which will become harder to debug over time and may need hacky patches.
The current installation process with pystan is as follows:
Mac OS / Linux
- End users usually use prophet from PyPi.
- End user must install
pystan=2.19.1.1first, as it is required for building the wheel - End user installs
prophet, which includes compiling the pystan model on their machine.
Windows
- End users usually use prophet from
conda-forge.
Proposal
- Use
cmdstan+cmdstanpyto build binary distributions for Pypi (using Github Actions) and conda-forge, across all platforms.- Packaging pre-compiled stan models per platform + python version means the end-user does not need to perform the build process on their machine. They won't even need their own
cmdstaninstallation since we will package the necessary executables into Prophet itself. - Only the lightweight wrapper library
cmdstanpyis required as a dependency.
- Packaging pre-compiled stan models per platform + python version means the end-user does not need to perform the build process on their machine. They won't even need their own
- Remove the dependency on
pystanaltogether.
This should not change how end-users typically interact with the Prophet package. The general flow of
m = Prophet()
m.fit(df)
future = m.make_future_dataframe()
m.predict(future)will remain unchanged, and all other diagnostic functions will work as normal.
It's just that behind the scenes, the model object will now be a cmdstanpy object rather than a pystan one. The argument stan_backend='PYSTAN' will also be deprecated. This will affect end users who retrieve the actual pystan object and work with it directly, but we expect this to be the minority.
We have already refactored the setup.py script to accomodate this new process (it currently supports both pystan 2.19.1.1 and cmdstanpy for backwards compatibility).
We have also built and tested PyPi wheels for macOS and Linux for Python versions 3.6-3.8. If you follow the instructions here, you can test these binary distributions on your machine.
Work required
For the next minor release (prophet 1.1.0), we should consider the following:
- Update existing conda build scripts to use the
cmdstan+cmdstanpybackend. - Remove the
pystanmodel compilation from the build process and removepystanas a Prophet dependency. - (Optional) Add support for a Windows wheel on PyPi.