腌制的FBProphet模型将在Heroku上奔跑
我没有这样的模型:
filename = f"models/{model_name}"
model = pickle.load(open(filename, 'rb'))
forecast = model.make_future_dataframe(periods=int(period), freq='MS')
forecast = model.predict(forecast)
我会收到此错误:
2022-04-28T00:12:11.900741+00:00 app[web.1]: File "/app/app.py", line 86, in create_figure_pred
2022-04-28T00:12:11.900742+00:00 app[web.1]: model = pickle.load(open(filename, 'rb'))
2022-04-28T00:12:11.900746+00:00 app[web.1]: ModuleNotFoundError: No module named 'pandas._libs.arrays'
这是一个烧瓶应用程序。
我读到,此错误的一个潜在解决方案是卸载并重新安装pandas,但是当我按下时,pandas是由需求安装的。
另一个可能的解决方案是明确导入pandas._libs._libs。
2022-04-28T00:28:20.465322+00:00 app[web.1]: File "/app/app.py", line 13, in <module>
2022-04-28T00:28:20.465322+00:00 app[web.1]: import pandas._libs.arrays
2022-04-28T00:28:20.465326+00:00 app[web.1]: ModuleNotFoundError: No module named
'pandas._libs.arrays'
我发现 Github上的问题如果我(例如,腌菜)然后在笔记本中取消挑剔时,请遇到这个问题。一切都按预期工作。
fbProphet肯定安装在应用中。我可以将模型安装在那里,但是页面段之前就可以完成。如果这是一个小数据集或预测期,则有效。
Github上还有另一个问题,没有人回应,听起来像是一个好问题。如果我可以再次找到它,我将在这里更新。
I am unpickling the model like so:
filename = f"models/{model_name}"
model = pickle.load(open(filename, 'rb'))
forecast = model.make_future_dataframe(periods=int(period), freq='MS')
forecast = model.predict(forecast)
I get this error:
2022-04-28T00:12:11.900741+00:00 app[web.1]: File "/app/app.py", line 86, in create_figure_pred
2022-04-28T00:12:11.900742+00:00 app[web.1]: model = pickle.load(open(filename, 'rb'))
2022-04-28T00:12:11.900746+00:00 app[web.1]: ModuleNotFoundError: No module named 'pandas._libs.arrays'
It's a Flask app.
I read that one potential solution for this error is to uninstall and reinstall pandas but pandas is installed by requirements.txt when I push.
Another possible solution is to import pandas._libs.arrays explicitly but this did not work.
2022-04-28T00:28:20.465322+00:00 app[web.1]: File "/app/app.py", line 13, in <module>
2022-04-28T00:28:20.465322+00:00 app[web.1]: import pandas._libs.arrays
2022-04-28T00:28:20.465326+00:00 app[web.1]: ModuleNotFoundError: No module named
'pandas._libs.arrays'
I found an issue on github but this isn't very helpful because I don't have this problem when if I, for example, pickle and then unpickle in a notebook. It all works as expected.
fbprophet is definitely installed in the app. I can fit the model there but the page times out before it finishes. If it's a small dataset or forecasting period, it works.
There was another issue on github that no one responded to and sounded like a good question. I'll update here if I can find it again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题。
看起来腌制的对象是用确实具有._libs.Arrays的Pandas的版本创建的,但是尝试泡菜的版本没有:
升级的Pandas:
现在看起来很高兴:
I had this same problem.
Looks like the pickled object was created with a version of pandas that does have ._libs.arrays, but the version attempting pickle.load does not :
Upgraded pandas :
Now it seems happy: