Trouble installing Torch on Google App Engine - google-app-engine

I've built a machine learning api that uses Torch as the ML framework. When I upload the code to Googe App Engine it runs out of memory.
After some debugging I found out that the issue it the installation of Torch.
I'm using Torch 1.5.0 and python 3.7.4
So how do I fix this error? Maybe I can change something i app.yaml?
Error message:
Step #1 - "builder": OSError: [Errno 12] Cannot allocate memory
Step #1 - "builder": self.pid = os.fork()
Step #1 - "builder": File "/usr/lib/python2.7/subprocess.py", line 938, in _execute_child
Step #1 - "builder": errread, errwrite)
Step #1 - "builder": File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/python/layer_builder.py", line 346, in _python_version
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/python/layer_builder.py", line 332, in GetCacheKeyRaw
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/python/layer_builder.py", line 109, in GetCacheKeyRaw
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/common/single_layer_image.py", line 60, in GetCacheKey
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/python/layer_builder.py", line 153, in BuildLayer
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/python/builder.py", line 114, in Build
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 54, in main
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder": exec code in run_globals
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder": "__main__", fname, loader, pkg_name)
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder": Traceback (most recent call last):
And again this error message didn't appear when i didn't include torch in my requirements.txt
to reproduce:
app.yaml
runtime: python37
resources:
memory_gb: 16
disk_size_gb: 10
requirements.txt
gunicorn==20.0.4
aniso8601==8.0.0
beautifulsoup4==4.9.0
boto3==1.13.3
botocore==1.16.3
bs4==0.0.1
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
colorama==0.4.3
docutils==0.15.2
filelock==3.0.12
Flask==1.1.2
Flask-RESTful==0.3.8
googletrans==2.4.0
idna==2.9
itsdangerous==1.1.0
Jinja2==2.11.2
jmespath==0.9.5
joblib==0.14.1
MarkupSafe==1.1.1
numpy==1.18.4
protobuf==3.11.3
python-dateutil==2.8.1
pytz==2020.1
regex==2020.4.4
requests==2.23.0
s3transfer==0.3.3
sacremoses==0.0.43
sentencepiece==0.1.86
six==1.14.0
soupsieve==2.0
tokenizers==0.5.2
tqdm==4.46.0
transformers==2.8.0
urllib3==1.25.9
Werkzeug==1.0.1
main.py
import flask
from flask import Flask, request
from flask_restful import Api, Resource
app = Flask(__name__)
api = Api(app)
production = False
import json
# Import api code
# Create main api 'view'
class main_api(Resource):
def get(self):
question = request.args.get('question')
# Run the script
# But not necessary for the minimum working test
return {
'question': question,
# 'results': results_from_script,
}
# Adds resource
api.add_resource(main_api, '/')
# Starts the api
if __name__ == '__main__':
host = '127.0.0.1'
port = 8080
app.run(host=host, port=port, debug=not production)

I fixed this error by using the flex enviroment.
The only thing I had to change was the app.yaml
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3
manual_scaling:
instances: 1
resources:
cpu: 2
memory_gb: 5
disk_size_gb: 10
And then it was ready to be deployed

Related

google-cloud-pubsub installation fails in coral developer board

Environment details:
Python 3.7.3
setuptools==51.0.0
I am just trying to install google-cloud-pubsub in coral developer board using the command,
pip install --upgrade --no-cache google-cloud-pubsub
When running the above command, it started installing the dependencies then after it goes for some grpcio build process as shown below.
Build log:
Building wheels for collected packages: grpc-google-iam-v1, grpcio
Building wheel for grpc-google-iam-v1 (setup.py) ... done
Created wheel for grpc-google-iam-v1: filename=grpc_google_iam_v1-0.12.3-py3-none-any.whl size=18501 sha256=2be51c55f5cab3ff97efdb39e3a6be07e5c2d030ca0a47a8358a8fa1efef58b6
Stored in directory: /tmp/pip-ephem-wheel-cache-rpj8jh5r/wheels/b9/ee/67/2e444183030cb8d31ce8b34cee34a7afdbd3ba5959ea846380
Building wheel for grpcio (setup.py) ... error
This process hangs for several minutes and got the error logs shown below printed.
Error:
Building wheel for grpcio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/mendel/.virtualenvs/cv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-1u5g0n_z
cwd: /tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/
Complete output (1234 lines):
ASM Builds for BoringSSL currently not supported on: linux-aarch64
Found cython-generated files...
running bdist_wheel
......................
lot of lines there ...!
......................
Traceback (most recent call last):
File "/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/src/python/grpcio/commands.py", line 267, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/mendel/.virtualenvs/cv/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/src/python/grpcio/_parallel_compile_patch.py", line 59, in _parallel_compile
_compile_single_file, objects)
File "/usr/lib/python3.7/multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'aarch64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for grpcio
Running setup.py clean for grpcio
Note: I have successfully installed google-cloud-storage==1.33.0

Installing google appengine on Google Colab Notebook

I am trying to import some files from my Google Cloud Storage bucket to a Google Colab Notebook. However, I face the following error using the snippet suggested by google.
Code:
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
# This only needs to be done once per notebook.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
# Download a file based on its file ID.
#
# A file ID looks like: laggVyWshwcyP6kEI-y_W3P8D26sz
file_id = '1NKNtpuP95NKNMTVao6qt8G-OJs_xmbnC'
downloaded = drive.CreateFile({'id': file_id})
print('Downloaded content "{}"'.format(downloaded.GetContentString()))
Error:
W0331 16:31:52.011976 139994604533632 __init__.py:44] file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
from google.appengine.api import memcache
ModuleNotFoundError: No module named 'google.appengine'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
from oauth2client.contrib.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery_cache/file_cache.py", line 37, in <module>
from oauth2client.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client.locked_file'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
from . import file_cache
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0
Downloaded content "{
"attention_probs_dropout_prob": 0.1,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"max_position_embeddings": 512,
"num_attention_heads": 12,
"num_hidden_layers": 12,
"type_vocab_size": 2,
"vocab_size": 28996
}
"
I understand that I have some modules missing and I need to install them. However, I tried
!export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
!echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
!curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
!apt update && apt install google-cloud-sdk
And faced the following error:
deb http://packages.cloud.google.com/apt main
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1326 100 1326 0 0 53040 0 --:--:-- --:--:-- --:--:-- 53040
OK
E: Malformed entry 1 in list file /etc/apt/sources.list.d/google-cloud-sdk.list (Component)
E: The list of sources could not be read.
I am new to Google Colab Notebooks and while I understand that it's a simple interactive notebook I am not able to get the hang of this.
Thanks,
It is a bug in googleapiclient, the code bellow will sove it.
import logging
logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR)
Ref : Github Reference Error

Quotas for Endpoint framework v2 in development environment and deployed project

Symptom:
I have a new standard environment endpoint framework (v2) project that works on the development server but when deployed to GCP the response is: This application is temporarily over its serving quota. Please try again later.
However if I try to add quota limits and metrics (as per https://cloud.google.com/endpoints/docs/frameworks/quotas-configure) the development server errors with: AttributeError: 'tuple' object has no attribute 'metric_name'.
The the full error logged is below. I suspect the warning about oauth2client is not relevant to the quota problem but is related to the current endpoints module.
The error seems to point to the limit_definitions but these are from the Google example.
Code snippet:
quota_limits = [
("read-requests", "Read Requests", 1000),
("list-requests", "List Requests", 100),
("write-requests", "Write Requests", 50),
]
#endpoints.api(
name='echo',
version='v1',
limit_definitions=quota_limits,
Question:
How can I either: not use quotas or correctly configure quotas? Or is there a bug?
SDK:
gcloud info
Google Cloud SDK [180.0.0]
Platform: [Linux, x86_64] ('Linux', 'host-name', '4.4.0-98-generic', '#121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017', 'x86_64', 'x86_64')
Python Version: [2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]
Installation Root: [/home/steve/google-cloud-sdk]
Installed Components:
core: [2017.11.10]
app-engine-python: [1.9.63]
gcloud: []
beta: [2017.09.15]
gsutil: [4.28]
cloud-datastore-emulator: [1.3.0]
bq: [2.0.27]
System PATH: [/home/steve/google-cloud-sdk/bin:/home/steve/.nvm/versions/node/v6.11.1/bin:/home/steve/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/steve/google-cloud-sdk/platform/google_appengine:/home/steve/Android/Sdk/tools:/home/steve/Android/Sdk/tools/bin:/home/steve/Android/Sdk/platform-tools:~/bin:~/.config/yarn/global/node_modules/.bin]
Python PATH: [/home/steve/google-cloud-sdk/lib/third_party:/home/steve/google-cloud-sdk/lib:/usr/lib/python2.7/:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [False]
There are alternate versions of the following Google Cloud Platform tools on your system PATH.
/home/steve/google-cloud-sdk/platform/google_appengine/dev_appserver.py
/home/steve/google-cloud-sdk/platform/google_appengine/endpointscfg.py
Installation Properties: [/home/steve/google-cloud-sdk/properties]
User Config Directory: [/home/steve/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/home/steve/.config/gcloud/configurations/config_default]
Account: [<removed-for-public-post>]
Project: [project-name]
Current Properties:
[core]
project: [project-name]
account: [<removed for public post>]
disable_usage_reporting: [False]
Logs Directory: [/home/steve/.config/gcloud/logs]
Last Log File: [/home/steve/.config/gcloud/logs/2017.11.18/11.00.31.517561.log]
git: [git version 2.7.4]
ssh: [OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016]
Full error displayed:
WARNING 2017-11-18 05:57:18,958 multistore_file.py:62] The oauth2client.contrib.multistore_file module has been deprecated and will be removed in the next release of oauth2client. Please migrate to multiprocess_file_storage.
ERROR 2017-11-18 05:57:19,080 wsgi.py:263]
Traceback (most recent call last):
File "/home/steve/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/steve/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/steve/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/steve/gae/prototyping/endpoint+fbauth/main.py", line 35, in <module>
'https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken#system.gserviceaccount.com')}
File "/home/steve/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/util.py", line 173, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/steve/gae/prototyping/endpoint+fbauth/lib/endpoints/api_config.py", line 1038, in api
limit_definitions=limit_definitions)
File "/home/steve/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/util.py", line 173, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/steve/gae/prototyping/endpoint+fbauth/lib/endpoints/api_config.py", line 508, in __init__
base_path=base_path, limit_definitions=limit_definitions)
File "/home/steve/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/util.py", line 173, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/steve/gae/prototyping/endpoint+fbauth/lib/endpoints/api_config.py", line 601, in __init__
_CheckLimitDefinitions(limit_definitions)
File "/home/steve/gae/prototyping/endpoint+fbauth/lib/endpoints/api_config.py", line 243, in _CheckLimitDefinitions
if not ld.metric_name:
AttributeError: 'tuple' object has no attribute 'metric_name'
quota_limits needs to be a list of endpoints.api_config.LimitDefinition instances, not a list of tuples. This is an error in the docs; I'll make sure they're corrected, and I'll improve the error message to be more clear.

gcloud connect to docker Daemon fail

I'm trying to test the new managed VM feature, following this tutorial (using OS X)
The boot2docker installation it's okay.
Executing $(boot2docker shellinit) give the following output:
Writing /Users/guilhermetorres/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/guilhermetorres/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/guilhermetorres/.boot2docker/certs/boot2docker-vm/key.pem
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/guilhermetorres/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
boot2docker status print running
and boot2docker version print Boot2Docker-cli version: v1.5.0
Although when I try to run my application using gcloud --verbosity debug preview app run
I got this error:
ERROR 2015-03-05 00:36:39,816 containers.py:742] Failed to connect to Docker Daemon due to: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
You can see the EV variables:
DEBUG 2015-03-05 00:36:39,800 containers.py:669] Detected docker environment variables: DOCKER_HOST=tcp://192.168.59.103:2376, DOCKER_CERT_PATH=/Users/guilhermetorres/.boot2docker/certs/boot2docker-vm, DOCKER_TLS_VERIFY=1
And the complete stack trace:
DEBUG: Running gcloud.preview.app.run with Namespace(admin_host=None, allow_skipped_files=False, api_host=None, appidentity_email_address=None, appidentity_private_key_path=None, auth_domain='gmail.com', blobstore_path=None, clear_datastore=False, cmd_func=<bound method Command.Run of <googlecloudsdk.calliope.backend.Command object at 0x10e9e5b50>>, command_path=['gcloud', 'preview', 'app', 'run'], datastore_consistency_policy='time', datastore_path=None, default_gcs_bucket_name=None, enable_cloud_datastore=False, enable_mvm_logs=False, enable_sendmail=False, format=None, h=None, help=None, host=None, jvm_flag=None, log_http=None, log_level=None, logs_path=None, markdown=None, max_module_instances=None, modules=['./app.yaml'], php_executable_path=None, project=None, python_startup_script=None, quiet=None, require_indexes=False, show_mail_body=False, smtp_allow_tls=False, smtp_host=None, smtp_password=None, smtp_user=None, storage_path=None, trace_token=None, use_mtime_file_watcher=False, user_output_enabled=None, verbosity='debug', version=None).
WARNING: The [application] field is specified in file [/Users/guilhermetorres/meetapp-xmpp-docker/app.yaml]. This field is not used by gcloud and should be removed.
DEBUG: Found Cloud SDK root: /Users/guilhermetorres/google-cloud-sdk
DEBUG: Found App Engine SDK root: /Users/guilhermetorres/google-cloud-sdk/platform/google_appengine
DEBUG: Command sys.path: ['/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/antlr3', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/fancy_urllib', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/ipaddr', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/rsa', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/pyasn1', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/pyasn1_modules', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/httplib2', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/oauth2client', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/concurrent', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/cherrypy', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/distutils', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/requests', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/six', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/websocket', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/jinja2-2.6', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/webob-1.2.3', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1', '/Users/guilhermetorres/google-cloud-sdk/./lib', '/Users/guilhermetorres/google-cloud-sdk/lib/googlecloudsdk/gcloud', '/Users/guilhermetorres/google-cloud-sdk/lib', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload']
DEBUG: Found Cloud SDK root: /Users/guilhermetorres/google-cloud-sdk
Module [default] found in file [/Users/guilhermetorres/meetapp-xmpp-docker/app.yaml]
INFO: Looking for the Dockerfile in /Users/guilhermetorres/meetapp-xmpp-docker
INFO: Using Dockerfile found in /Users/guilhermetorres/meetapp-xmpp-docker
DEBUG: Found Cloud SDK root: /Users/guilhermetorres/google-cloud-sdk
DEBUG: Skipping pull for runtime: custom
DEBUG: Running [dev_appserver.py] with: --allow_skipped_files=False --application=meetapp-xmpp --auth_domain=gmail.com --clear_datastore=False --datastore_consistency_policy=time --dev_appserver_log_level=debug --enable_cloud_datastore=False --enable_mvm_logs=False --enable_sendmail=False --log_level=debug --require_indexes=False --show_mail_body=False --skip_sdk_update_check=True --smtp_allow_tls=False --use_mtime_file_watcher=False /Users/guilhermetorres/meetapp-xmpp-docker/app.yaml
DEBUG 2015-03-05 00:36:39,759 application_configuration.py:159] setting forwarded ports 5280,5222,8088
INFO 2015-03-05 00:36:39,759 devappserver2.py:726] Skipping SDK update check.
DEBUG 2015-03-05 00:36:39,799 wsgi_server.py:384] Failed to bind "fe80::1%lo0:56987": ('Unable to bind fe80::1%lo0:56987', error(49, "Can't assign requested address"))
INFO 2015-03-05 00:36:39,799 api_server.py:172] Starting API server at: http://localhost:56987
DEBUG 2015-03-05 00:36:39,800 containers.py:669] Detected docker environment variables: DOCKER_HOST=tcp://192.168.59.103:2376, DOCKER_CERT_PATH=/Users/guilhermetorres/.boot2docker/certs/boot2docker-vm, DOCKER_TLS_VERIFY=1
ERROR 2015-03-05 00:36:39,816 containers.py:742] Failed to connect to Docker Daemon due to: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
INFO 2015-03-05 00:36:39,817 api_server.py:588] Applying all pending transactions and saving the datastore
INFO 2015-03-05 00:36:39,817 api_server.py:591] Saving search indexes
Traceback (most recent call last):
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 985, in <module>
main()
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 978, in main
dev_server.start(options)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 774, in start
self._dispatcher.start(options.api_host, apis.port, request_data)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 182, in start
_module, port = self._create_module(module_configuration, port)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 262, in _create_module
threadsafe_override=threadsafe_override)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1463, in __init__
super(ManualScalingModule, self).__init__(**kwargs)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 514, in __init__
self._module_configuration)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 237, in _create_instance_factory
module_configuration=module_configuration)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py", line 78, in __init__
timeout=self.DOCKER_D_REQUEST_TIMEOUT_SECS)
File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 743, in NewDockerClient
raise DockerDaemonConnectionError(DOCKER_CONNECTION_ERROR)
google.appengine.tools.docker.containers.DockerDaemonConnectionError: Couldn't connect to the docker daemon.
Please check if the environment variables DOCKER_HOST, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are set correctly. If you are using boot2docker, you can set them up by executing the commands that are shown by:
boot2docker shellinit
DEBUG: Error [1] while running DevAppSever with: [--allow_skipped_files=False --application=meetapp-xmpp --auth_domain=gmail.com --clear_datastore=False --datastore_consistency_policy=time --dev_appserver_log_level=debug --enable_cloud_datastore=False --enable_mvm_logs=False --enable_sendmail=False --log_level=debug --require_indexes=False --show_mail_body=False --skip_sdk_update_check=True --smtp_allow_tls=False --use_mtime_file_watcher=False /Users/guilhermetorres/meetapp-xmpp-docker/app.yaml]
DEBUG: (gcloud.preview.app.run) DevAppSever failed with error code [1]
Traceback (most recent call last):
File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 551, in Execute
result = args.cmd_func(cli=self, args=args)
File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1025, in Run
result = command_instance.Run(args)
File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
return func(*args, **kwargs)
File "/Users/guilhermetorres/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/run.py", line 317, in Run
runner.Start(*runnables)
File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/appengine_adapter.py", line 413, in Start
raise DevappserverExecutionError(return_code, argv)
ToolException: DevAppSever failed with error code [1]
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]
After reading this issue https://github.com/docker/docker-py/issues/465, and uninstall homebrew (brew remove python)Python everything works fine.

GAE creating a new project?

i have been working on GAE - tried to create a new project: and getting an error on command
abid#abid-webdev:~/Documents/GAE_projects$ python google_appengine/dev_appserver.py exe1.py/
ERROR
INFO 2013-10-29 08:27:57,104 module.py:608] default: "GET / HTTP/1.1" 500 -
ERROR 2013-10-29 08:29:43,171 wsgi.py:262]
Traceback (most recent call last):
File "/home/abid/Documents/GAE_projects/google_appengine/google/appengine/runtime/wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/abid/Documents/GAE_projects/google_appengine/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/abid/Documents/GAE_projects/google_appengine/google/appengine/runtime/wsgi.py", line 84, in LoadObject
obj = import(path[0])
ImportError: No module named helloworld
INFO 2013-10-29 08:29:43,191 module.py:608] default: "GET / HTTP/1.1" 500 -
ERROR 2013-10-29 08:29:51,775 wsgi.py:262]
Traceback (most recent call last):
File "/home/abid/Documents/GAE_projects/google_appengine/google/appengine/runtime/wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/abid/Documents/GAE_projects/google_appengine/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/abid/Documents/GAE_projects/google_appengine/google/appengine/runtime/wsgi.py", line 84, in LoadObject
obj = import(path[0])
ImportError: No module named helloworld
1) ImportError: No module named helloworld -> i noticed this error
currently working on this project exercise1, copied app.yaml file from previous project helloworld/
checked app.yaml and it's content are as follows:
application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld.application>
2) on google URL -> Every request to a URL whose path matches the regular expression /.* (all URLs) should be handled by the application object in the helloworld module.
3) my directory structure
abid#abid-webdev:~/Documents/GAE_projects$ ls
exercise1
helloworld
google_appengine
Question:
how can i modify my app.yaml to work with my other projects e.g.
exercise1?
thanks all for your help.
Let's take this from the top!
For your new project you will need to have this structure in the exercise1 directory:
Directory: exercise1
File: app.yaml
File: exercise1.py
In the app.yaml you'll need something like this:
application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: exercise1.application
The line "script: exercise1.application" tells it which file to use (in this case exercise1.py) and the instance of a WSGI Handler to use (in this case application)
In exercise1.py you'll need something like this:
import webapp2
class HomePage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hey Y'all!')
application = webapp2.WSGIApplication([
('/', HomePage),
], debug=True)
Here you can see application that we referred to in app.yaml.
Once you have this basic structure you need to start the dev appserver. The way you are doing it in the question is incorrect:
You need to run the dev_appserver with the directory "exercise1", not a python file.
Assuming that the Google App Engine sdk is still located at "~/Documents/GAE_projects/google_appengine" run the following command from the exercise1 directory:
python ~/Documents/GAE_projects/google_appengine/dev_appserver.py ./
This will start the dev_appserver.py script telling it to use the current directory (which is what the "./" means).
If you follow this, then you should be up and rolling!

Resources