Closed laurencezabanal closed 1 year ago
Same here..
I found the same error when I was running my chunk. Please, any help?
The attribute stan_backend
is set here:
https://github.com/facebook/prophet/blob/8306ae3519d78581ab0a5c1a22954da09d6f2bda/python/fbprophet/forecaster.py#L143-L154
It seems that the pystan model is not being loaded correctly. To verify, could you run this and let me know what messages are printed out:
from fbprophet import Prophet
import logging
logger = logging.getLogger('fbprophet')
logger.setLevel(logging.DEBUG)
m = Prophet()
print(m.stan_backend)
The debug message should explain why it isn't loading the backend.
Hi, this is the error:
AttributeError: 'Prophet' object has no attribute 'stan_backend'
Detailed traceback:
File "<string>", line 1, in <module>
File "C:\Users\MAGUL\AppData\Local\r-miniconda\envs\r-reticulate\lib\site-packages\fbprophet\forecaster.py", line 141, in __init__
self._load_stan_backend(stan_backend)
File "C:\Users\MAGUL\AppData\Local\r-miniconda\envs\r-reticulate\lib\site-packages\fbprophet\forecaster.py", line 154, in _load_stan_backend
logger.debug("Loaded stan backend: %s", self.stan_backend.get_type())
same problem here
Hi All,
I have managed to solve this issue using hook files of PyInstaller.
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
hiddenimports = collect_submodules('fbprophet') datas = collect_data_files('fbprophet')
2. hook-pystan.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
hiddenimports = collect_submodules('pystan') datas = collect_data_files('pystan')
3. hook-Cython.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
hiddenimports = collect_submodules('Cython') datas = collect_data_files('Cython')
Now, I could run my one-file executable without any problems.
**See:** https://pyinstaller.readthedocs.io/en/stable/hooks.html
**Note:** It also increases the size of the executable
Hi Taha,
Well done, but I am not suceed. Look the error that return
ModuleNotFoundError: No module named 'PyInstaller'
Detailed traceback:
File "<string>", line 1, in <module>
Same problem
File "C:\Users\Patricia\AppData\Local\Programs\Python\Python37\lib\site-packages\fbprophet\forecaster.py", line 154, in _load_stan_backend
logger.debug("Loaded stan backend: %s", self.stan_backend.get_type())
AttributeError: 'Prophet' object has no attribute 'stan_backend'
"
I solved this running the setup process: ` - wget https://github.com/stan-dev/cmdstan/releases/download/v2.22.1/cmdstan-2.22.1.tar.gz -O /tmp/cmdstan.tar.gz > /dev/null
Once installed with conda, you can copy paste the stan_model folder into the fbprophet directory. So it would not be necessary to compile again with pystan. You can search for the stan_model folder inside the "External Libraries" folder you have on the left on the IDE. Hope it helps
Getting the same error. Any fix ?
File "C:\Users\Mypc\PycharmProjects\COVID19India\venv\lib\site-packages\fbprophet\forecaster.py", line 154, in _load_stan_backend logger.debug("Loaded stan backend: %s", self.stan_backend.get_type()) AttributeError: 'Prophet' object has no attribute 'stan_backend'
To be clear: This issue is about using PyInstaller to create a binary. If you're running into this error when not using PyInstaller, then it will probably be a different source and it'd be best to open a different issue.
Any updates here?
Hey guys,
For some reason, copying Cython's folder from Anaconda's site-packages folder to the executable's location solved this problem for me. Must be related to some pystan dependencies or to the way that pyinstaller locates them. Anyhow, hope it helps!
Hi All,
I have managed to solve this issue using hook files of PyInstaller.
1. hook-fbprophet.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('fbprophet') datas = collect_data_files('fbprophet')
1. hook-pystan.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('pystan') datas = collect_data_files('pystan')
1. hook-Cython.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('Cython') datas = collect_data_files('Cython')
Now, I could run my one-file executable without any problems.
See: https://pyinstaller.readthedocs.io/en/stable/hooks.html Note: It also increases the size of the executable
works great for me
Hi All, I have managed to solve this issue using hook files of PyInstaller.
1. hook-fbprophet.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('fbprophet') datas = collect_data_files('fbprophet')
1. hook-pystan.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('pystan') datas = collect_data_files('pystan')
1. hook-Cython.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('Cython') datas = collect_data_files('Cython')
Now, I could run my one-file executable without any problems. See: https://pyinstaller.readthedocs.io/en/stable/hooks.html Note: It also increases the size of the executable
works great for me
Could you tell some more details of the versions of the modules? I had no luck on using these hooks for PyInstaller on Linux to build fbprophet model.
Hi All, I have managed to solve this issue using hook files of PyInstaller.
1. hook-fbprophet.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('fbprophet') datas = collect_data_files('fbprophet')
1. hook-pystan.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('pystan') datas = collect_data_files('pystan')
1. hook-Cython.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('Cython') datas = collect_data_files('Cython')
Now, I could run my one-file executable without any problems. See: https://pyinstaller.readthedocs.io/en/stable/hooks.html Note: It also increases the size of the executable
works great for me
Could you tell some more details of the versions of the modules? I had no luck on using these hooks for PyInstaller on Linux to build fbprophet model.
Never mind. Problem got resolved. The hook method indeed worked.
Hi, Hooking method didn't work for me getting the same error .
AttributeError Traceback (most recent call last)
I have the same error message "AttributeError: 'Prophet' object has no attribute 'stan_backend'" and tried various suggestions. My Python3.8.5 is installed with Anaconda on Windows 10.
C:\Users\User\anaconda3\Lib\site-packages\PyInstaller\hooks
per TahaBerkay's instruction. I still get error message. Do I miss something here?make -C /tmp/cmdstan-2.26.1/ build
was completed successfully. What's the step of CMDSTAN=/tmp/cmdstan-2.22.1 STAN_BACKEND=CMDSTANPY python setup.py install
? Why do we need python setup.py install
here?Any help is really appreciated.
Thanks.
I searched "stan_model" folder inside C:\Users\User\anaconda3 and found this one: C:\Users\User\anaconda3\pkgs\prophet-1.0.1-py38h43734a8_3\Lib\site-packages\prophet\stan_model
. I copied it to C:\Users\User\anaconda3\Lib\site-packages\fbprophet
and the issue is fixed.
Thanks.
please help me ,我遇到了这个问题
Hi All,
I have managed to solve this issue using hook files of PyInstaller.
- hook-fbprophet.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('fbprophet') datas = collect_data_files('fbprophet')
- hook-pystan.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('pystan') datas = collect_data_files('pystan')
- hook-Cython.py:
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('Cython') datas = collect_data_files('Cython')
Now, I could run my one-file executable without any problems.
See: https://pyinstaller.readthedocs.io/en/stable/hooks.html Note: It also increases the size of the executable
thank you, it helps me
Closing in favor of #2462
I'm trying to create an executable file wherein my code imports fbprophet. It was successfully converted but upon running the function that calls fbprophet I'm getting an error of AttributeError: 'Prophet' object has no attribute 'stan_backend' anyone who encountered this? I'm using virtualenv and tried installing cython and pystan first before fbprophet.
Hopeful to hear from you guys. Python noob here as I'm originally using R