Installing prophet works just fine in MacOS but when you actually trying to use it there is a bug.
You need to add a path prophet_model.bin to make it work.
-
https://stackoverflow.com/questions/73255165/library-not-loaded-rpath-libtbb-dylib-in-prophet-python
-
https://stackoverflow.com/questions/73408919/dyld3169-library-not-loaded-rpath-libtbb-dylib
RuntimeError: Error during optimization! Command '/Users/panos/Projects/data_insights_ml_projects/.venv/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin random seed=23553 data file=/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmp49u7sp0d/dw4q_ya0.json init=/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmp49u7sp0d/q_n0ew7x.json output file=/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmp49u7sp0d/prophet_modelad1n144o/prophet_model-20230411135054.csv method=optimize algorithm=newton iter=10000' failed: console log output:
dyld[93061]: Library not loaded: @rpath/libtbb.dylib
Referenced from: <B751EB7E-D562-3B7A-8F3E-8E9E671ED028> /Users/panos/Projects/data_insights_ml_projects/.venv/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin
Reason: tried: '/private/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmpzp6oxmuk/prophet-1.1.1/build/lib.macosx-13-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmpzp6oxmuk/prophet-1.1.1/build/lib.macosx-13-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/private/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmpzp6oxmuk/prophet-1.1.1/build/lib.macosx-13-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/17/bdn0zqx94m19pwr88gqp9f2w0000gn/T/tmpzp6oxmuk/prophet-1.1.1/build/lib.macosx-13-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/usr/local/lib/libtbb.dylib' (no such file), '/usr/lib/libtbb.dylib' (no such file, not in dyld cache)
What's happening is that prophet is looking for the libtbb library in all the various paths referenced by rpath.
For whatever reason, the actual path where the library was installed is not in rpath. Here's how to fix it.
First, cd into the folder within the prophet package that contains prophet_model.bin then run the following command
> cd /Users/panos/Projects/data_insights_ml_projects/.venv/lib/python3.9/site-packages/prophet/stan_model
> install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb prophet_model.bin
OR
> cd $(poetry env info --path)/lib/python3.11/site-packages/prophet/stan_model
> install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb prophet_model.bin
Note that I added stan/lib/stan_math/lib/tbb to the /path/to/cmdstan/ you set. That's where the libtbb library sits.