2017-10-19 74 views
0

在用戶界面上運行:它接受一個字符串,將它帶到後端(使用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使用它?

回答

0

我會後我找到了解決辦法:

雖然我main.py不需要SciPy的或sklearn,我需要無論在requirements.txt這些模塊的泡菜文件之一。在部署到App Engine時,請確保您的requirements.txt是一致的。