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.08k stars 4.49k forks source link

access denied to prophet/stan_model/prophet_model.bin #2243

Open iamadouhassane opened 1 year ago

iamadouhassane commented 1 year ago

Hello everyone,

Need your helps to resolve an issue when installing and packaging prophet library to use it for aws lambda layer. I already do this work twice with python3.5 and python3.6. But for now in python 3.9 , I have the below problem to access to prophet/stan_model/prophet_model.bin when calling prophet library in my aws lambda. I try installation with pip3.9 and sudo pip3.9 but I have the same issue. But , i have good import because when i do

import prophet print(dir(prophet))

I have : (['Prophet', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', 'diagnostics', 'forecaster', 'hdays', 'make_holidays', 'models', 'plot']

I do this work on :

  1. linux Debian -amd64 (4.9.320-2 (2022-06-30) x86_64)
  2. python3.9
  3. prophet 1.1

So thanks a lot for your help: NB : I install it on the linux machine and it works well . It is only when i use it on aws lambda that i have this issue

[ERROR] RuntimeError: Failed with error [Errno 13] Permission denied: '/tmp/prophet/prophet/stan_model/prophet_model.bin'

Traceback (most recent call last): File "/var/task/lambda_function.py", line 51, in lambda_handler import test_fb File "/var/task/test_fb.py", line 12, in m.fit(df) File "/tmp/prophet/prophet/forecaster.py", line 1171, in fit self.params = self.stan_backend.fit(stan_init, dat, kwargs) File "/tmp/prophet/prophet/models.py", line 110, in fit self.stan_fit = self.model.optimize(args) File "/tmp/prophet/cmdstanpy/model.py", line 724, in optimize self._run_cmdstan(runset, dummy_chain_id, show_console=show_console) File "/tmp/prophet/cmdstanpy/model.py", line 1603, in _run_cmdstan raise RuntimeError(msg) from e

prophet_issue

ankup007 commented 1 year ago

hi @iamadouhassane were you able to solve this issue? I am facing the same issue.

lisong891 commented 8 months ago

你好@iamadouhassane @ankup007 你能解决这个问题吗?我面临着同样的问题。

iamadouhassane commented 8 months ago

Sorry @ankup007 for my late i don't see your message @lisong891 @ankup007 i resolve this problem by installing directly fbprophet in my lambda function. It is not the best way but the fact to use layer create a lot of issue

iamadouhassane commented 8 months ago

@ankup007 @lisong891 this is the code you can create a pytrhon file name install_package.py with this code and call it in the lambda_function

` import sys, os, shutil from subprocess import run, PIPE, STDOUT, check_output

def updated_and_install_libraries(instruction): if float(sys.executable.split("/")[-1].split('python')[-1:][0])>=3.8: result = run(instruction, stdout=PIPE, stderr=STDOUT, shell=True,text=True) else: result = run(instruction, stdout=PIPE, stderr=STDOUT, shell=True) print(result.stdout)

all_packages = {"prophet":"prophet"} python_version = sys.executable.split("/")[-1]

for package_name in all_packages: updated_and_install_libraries(python_version + ' -m pip install ' + all_packages[package_name] + ' --upgrade -t ' + "/tmp/" + package_name+"/")

`

lisong891 commented 8 months ago

Thank you for your help. I copied the prophet  files from site packages under local Linux to the cloud server and encountered the same problem. I will try again using your method.

1021372616 @.***

 

------------------ 原始邮件 ------------------ 发件人: "facebook/prophet" @.>; 发送时间: 2023年11月7日(星期二) 晚上10:42 @.>; @.**@.>; 主题: Re: [facebook/prophet] access denied to prophet/stan_model/prophet_model.bin (Issue #2243)

Sorry @ankup007 for my late i don't see your message @lisong891 @ankup007 i resolve this problem by installing directly fbprophet in my lambda function. It is not the best way but the fact to use layer create a lot of issue

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>