谷歌应用程序引擎POST 500失踪模块sklearn.pipeline
问题描述:
在用户界面上运行:它接受一个字符串,将它带到后端(使用Flask,名为main.py
),执行一些ML魔术,并将JSON返回到前端。谷歌应用程序引擎POST 500失踪模块sklearn.pipeline
在本地运行UI可以正常工作,但是在将其部署到Google的App Engine时,我会得到状态500.查看日志,我看到我有一个moduleError: No module named sklearn.pipeline
事情是,我不使用它,也不是在我的requirements.txt
下面是从日志查看器中的回溯对象:
Traceback (most recent call last):
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/vmagent/app/main.py", line 61, in run_pipeline
text_clf = pickle.load(handle)
ImportError: No module named sklearn.pipeline
{
insertId: "1mjwzxmecegyg"
labels: {
appengine.googleapis.com/instance_name: "aef-default-20171019t101524-k2kk"
compute.googleapis.com/resource_id: "7187158353674854010"
compute.googleapis.com/resource_name: "31d3314567f8"
compute.googleapis.com/zone: "us-central1-b"
}
logName: "projects/maximal-ascent-183217/logs/appengine.googleapis.com%2Fstderr"
receiveTimestamp: "2017-10-19T17:37:19.968312342Z"
resource: {
labels: {
module_id: "default"
project_id: "maximal-ascent-183217"
version_id: "20171019t101524"
}
type: "gae_app"
}
textPayload: "Traceback (most recent call last):
File "/env/local/lib/python2.7/site-packages/flask/app.py",
line 1982,
in wsgi_app
response = self.full_dispatch_request()
File "/env/local/lib/python2.7/site-packages/flask/app.py",
line 1614,
in full_dispatch_request
rv = self.handle_user_exception(e)
File "/env/local/lib/python2.7/site-packages/flask/app.py",
line 1517,
in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/env/local/lib/python2.7/site-packages/flask/app.py",
line 1612,
in full_dispatch_request
rv = self.dispatch_request()
File "/env/local/lib/python2.7/site-packages/flask/app.py",
line 1598,
in dispatch_request
return self.view_functions[rule.endpoint](** req.view_args)
File "/home/vmagent/app/main.py",
line 61,
in run_pipeline
text_clf = pickle.load(handle)
ImportError: No module named sklearn.pipeline "
timestamp: "2017-10-19T17:37:18Z"
}
困惑什么就在这一点上做的事:我应该安装的模块,并在我的main.py使用它?
答
我会后我找到了解决办法:
虽然我main.py不需要SciPy的或sklearn,我需要无论在requirements.txt这些模块的泡菜文件之一。在部署到App Engine时,请确保您的requirements.txt是一致的。