prophet
prophet copied to clipboard
[Python] Error when running fit(): Library not loaded: '@rpath/libtbb.dylib'
When running Prophet().fit()
on a Mac (Monterey 12.5.1
, Apple M1 Max Chip), I get the following error message:
cmdstanpy - ERROR - Chain [1] error: terminated by signal 6 Unknown error: -6
Traceback (most recent call last):
File "/Users/xxx/xxx/xxx/xxx/xxx/xxx/tests/test_prophet.py", line 67, in <module>
test_prophet()
File "/Users/xxx/xxx/xxx/xxx/xxx/xxx/tests/test_prophet.py", line 29, in test_prophet
model.fit(df)
File "/Users/xxx/xxx/xxx/xxx/xxx/xxx/.venv/lib/python3.8/site-packages/prophet/forecaster.py", line 1171, in fit
self.params = self.stan_backend.fit(stan_init, dat, **kwargs)
File "/Users/xxx/xxx/xxx/xxx/xxx/xxx/.venv/lib/python3.8/site-packages/prophet/models.py", line 112, in fit
raise e
File "/Users/xxx/xxx/xxx/xxx/xxx/xxx/.venv/lib/python3.8/site-packages/prophet/models.py", line 102, in fit
self.stan_fit = self.model.optimize(**args)
File "/Users/xxx/xxx/xxx/xxx/xxx/xxx/.venv/lib/python3.8/site-packages/cmdstanpy/model.py", line 731, in optimize
raise RuntimeError(msg)
RuntimeError: Error during optimization: console log output:
dyld[29330]: Library not loaded: '@rpath/libtbb.dylib'
Referenced from: '/Users/xxx/xxx/xxx/xxx/xxx/xxx/.venv/lib/python3.8/site-packages/prophet/stan_model/prophet_model.bin'
Reason: tried: '/private/var/folders/h2/rc68jj_17r1dp8c05qbhlr500000gn/T/pip-req-build-lk5m800e/build/lib.macosx-10.14-arm64-cpython-38/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/private/var/folders/h2/rc68jj_17r1dp8c05qbhlr500000gn/T/pip-req-build-lk5m800e/build/lib.macosx-10.14-arm64-cpython-38/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)
I ran my code in VSCode and used poetry add prophet
to install prophet in my project's env. This is prophet v1.1. Any ideas or help are welcome.
The same issue on M1 using v1.1
hit the same issue on my M1 laptop, however, 1.0 works for me, does 1.1 have a big advantage in perf compared to 1.0?
I couldn't get v1.0.1 to install. Running poetry add prophet==1.0.1
failed. When poetry got to installing pystan 2.19.1.1, I got the following error:
error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/Users/xxx/xxx/xxx/xxx/xxx/xxx/.venv/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c pystan/_misc.cpp -o build/temp.macosx-12-arm64-3.10/pystan/_misc.o -Os -ftemplate-depth-256 -Wno-unused-function -Wno-uninitialized -std=c++1y" failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pystan
After doing some digging I found a workable setup. I was previously running python 3.10
. Per #2002, the following configuration works with M1:
- python
3.8.13
- cmdstanpy
0.9.68
- prophet
1.0.1
- pystan
2.19.1.1
Prophet 1.1
does not seem compatible with python 3.10
with the M1 chip.
Same problem here. prophet 1.1
does not run on Mac M1, even on Python 3.8
. Is there a fix in planning?
But the configuration above 👆 with prophet 1.0
and Python 3.8
works.
here's how I got this working with homebrew [email protected], might be similar for venv and other homebrew versions
cd /opt/homebrew/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
https://gist.github.com/thewisenerd/52f937d01b06287ccf21a05a118e74ad
here's how I got this working with homebrew [email protected], might be similar for venv and other homebrew versions
cd /opt/homebrew/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
https://gist.github.com/thewisenerd/52f937d01b06287ccf21a05a118e74ad
The above worked for me using python 3.11.0 (installed using pyenv)
, poetry==1.2.2
, cmdstanpy==1.0.8
, prophet==1.1.1
. Instead of looking in the homebrew
directory for stan_model
, look at the virtualenv of where prophet was installed:
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
Got it to work with conda env python 3.10, prophet 1.1.1 with the solution suggested by @thewisenerd Thx!
Got this working on python 3.10
, and prophet==1.1.2
on my M1 Pro Macbook using the last line of @thewisenerd's solution:
install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb prophet_model.bin
In my case I was using a poetry
environment so I just had to go to my virtualenv's prophet
installation folder.
thx! @thewisenerd , it works for me on Mac M1 Monterey, python 3.9, prophet 1.1.1
Having python 3.9.16
and prophet==1.1
, this solved the issue on M1:
install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb .venv/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin
and my tests passed successfully as on linux.
so it's broken on M1 but fixable, no need to downgrade prophet
😎
thx for the suggestions! The fix of thewisenerd worked as suggested:
install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb ./venv/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
Having python 3.10.8
and prophet==1.1.2
on a M1.
thx for the suggestions! it works for me! My environment is listed as below:
- Poetry + PyEnv
- python == 3.8.13
pip install pystan==2.19.1.1
pip install cmdstanpy==1.0.4
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
prophet = "^1.1.2"
thx for the suggestions! The fix of thewisenerd worked as suggested:
install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb ./venv/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
Having
python 3.10.8
andprophet==1.1.2
on a M1.
I got it working on my Apple M2 Pro machine!
I had to fix 1 line after install and make 3 symlinks for not loaded libraries.
See the post:
https://stackoverflow.com/a/76264243/1396899
Got this working on my py venv on Mac M1 (as per @thewisenerd 's suggestion)
Configuration
Python 3.9.6
prophet==1.1.1
cmdstanpy==1.1.0
pystan==2.19.1.1
- cd into the directory where
stan_model
library is installed (from your venv directory)
cd lib/python3.9/site-packages/prophet/stan_model/
- Add rpath
install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb prophet_model.bin
@abhishek-j16's solution worked for me as well (Apple M2, Python 3.10, Prophet 1.1.3)
Can you tell when this issue will be solved? I cant work with prophet on my m1 mac because of this issue
I'm having trouble working on Prophet because of this problem. Could you share the working library versions for M1 Ventura 13.5.1 and Python 11 version?
I'm still having trouble
Having the same issue. Will anyone be assigned to this issue?