Reputation: 731
I am trying to deploy a flask application on google cloud. In spite of following their instructions, whenever I start dev server, it cannot find the library given vendor.add('lib')
. How to fix this?
sudo /google-cloud-sdk/bin/dev_appserver.py app.yaml > file
INFO 2017-10-10 20:20:04,276 devappserver2.py:115] Skipping SDK update check.
INFO 2017-10-10 20:20:04,338 api_server.py:299] Starting API server at: http://localhost:53496
WARNING 2017-10-10 20:20:04,338 dispatcher.py:285] Your python27 micro version is below 2.7.12, our current production version.
INFO 2017-10-10 20:20:04,343 dispatcher.py:224] Starting module "default" running at: http://localhost:8080
INFO 2017-10-10 20:20:04,345 admin_server.py:116] Starting admin server at: http://localhost:8000
/deploy_10oct/lib
ERROR 2017-10-10 20:20:11,913 wsgi.py:263]
Traceback (most recent call last):
File "/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "deploy_10oct/main.py", line 11, in <module>
import h5py
ImportError: No module named h5py
INFO 2017-10-10 20:20:11,919 module.py:821] default: "GET / HTTP/1.1" 500 -
Directory structure
ls
app.yaml
env
lame.pyc
main.pyc
templates
appengine_config.py
lib
requirements.txt
uploads
appengine_config.pyc
lame.py
main.py
static
Upvotes: 0
Views: 443
Reputation: 39814
You need to create a lib
dir inside your application and install your dependencies in that dir (not on your system's python installation). From Installing a third-party library:
Create a directory to store your third-party libraries, such as
lib/
.mkdir lib
Use pip (version 6 or later) with the
-t <directory>
flag to copy the libraries into the folder you created in the previous step. For example:pip install -t lib/ <library_name>
Upvotes: 1