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.44k stars 4.53k forks source link

prophet-1.1.1 wheel built from prophet-1.1.1 sdist is not functional #2266

Open f3flight opened 2 years ago

f3flight commented 2 years ago

Hello all,

I've been testing prophet-1.1.1 while building from sdist, and I ran into a problem - the resulting wheel is not functional, as embedded libraries are not properly linked in the stan model blob:

>>> import pandas as pd; from prophet import Prophet
Importing plotly failed. Interactive plots will not work.
>>> Prophet().fit(pd.DataFrame({"ds": ["2020-01-01", "2020-01-02", "2020-01-03"], "y": [1, 2, 3]}))
21:34:29 - cmdstanpy - INFO - Chain [1] start processing
21:34:29 - cmdstanpy - INFO - Chain [1] done processing
21:34:29 - cmdstanpy - ERROR - Chain [1] error: program not found Key has expired
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/coder/venv/lib/python3.10/site-packages/prophet/forecaster.py", line 1174, in fit
    self.params = self.stan_backend.fit(stan_init, dat, **kwargs)
  File "/home/coder/venv/lib/python3.10/site-packages/prophet/models.py", line 100, in fit
    raise e
  File "/home/coder/venv/lib/python3.10/site-packages/prophet/models.py", line 96, in fit
    self.stan_fit = self.model.optimize(**args)
  File "/home/coder/venv/lib/python3.10/site-packages/cmdstanpy/model.py", line 731, in optimize
    raise RuntimeError(msg)
RuntimeError: Error during optimization: console log output:

/home/coder/venv/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin: error while loading shared libraries: libtbb.so.2: cannot open shared object file: No such file or directory
(venv) [coder@prophet-1-1-1]$ find /home/coder/venv/ -name libtbb.so.2
/home/coder/venv/lib/python3.10/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2

Steps I use to reproduce this are:


# create venv
pip download prophet-1.1.1 --no-binary prophet
pip wheel prophet-1.1.1.tar.gz  # downloaded sdist - result of the prev command
pip install prophet-1.1.1-cp310-cp310-linux_x86_64.whl  # locally built wheel - result of the prev command
f3flight commented 2 years ago

Installing prophet from sdist bears the same result (as expected, because that also builds the wheel and installs it)

pip install prophet-1.1.1 --no-binary prophet

This command also builds the wheel under the hood, successfully, and installs it, but library is not functional.

Pre-built manylinux wheels published on pypi.org are functional.

WardBrian commented 2 years ago

The wheels built in this repo use cibuildwheel, which on Linux uses auditwheel repair to de-locate the built wheel. This is necessary to update the library lookup path of the built model.

Can I ask why you are building your own wheels from the sdist? If your goal is to install the package from source, your best bet is to first install CmdStan on your machine and then set the environment variable PROPHET_REPACKAGE_CMDSTAN=false

f3flight commented 2 years ago

Hi @WardBrian!

Can I ask why you are building your own wheels from the sdist?

Company security policy is to build artifacts from source whenever possible.

Thanks for the suggestion with CmdStan, I cannot use this route in my environment unfortunately.

I understand that auditwheel is used to create manylinux wheels, which is standard. However, auditwheel is meant to unlink/copy system-specific libraries into the wheel, to make the wheel portable/usable on other systems. The wheel should be usable on the host where it was built out-of-the-box, without auditwheel. The fact that it is not means that something in the build process is not set up correctly, and auditwheel repair is just masking this problem, a workaround essentially.

prophet26 commented 1 year ago

Please can you help me understand this as well as give me a directive on how and where to start?