4

I have installed the latest version of google cloud sdk, google-cloud-sdk-app-engine-python on my Ubuntu PC as mentioned in the docs in-order to test google-cloud-endpoints-framework sample app.

But on invoking an api request, I got the below traceback. Seems like there is a conflict between google package inside GAE sdk and the google package installed automatically to the lib folder because of google-endpoints package.

$ dev_appserver.py app.yaml
INFO     2017-03-14 07:51:36,173 devappserver2.py:764] Skipping SDK update check.
INFO     2017-03-14 07:51:36,199 api_server.py:268] Starting API server at: http://localhost:44561
INFO     2017-03-14 07:51:36,213 dispatcher.py:199] Starting module "default" running at: http://localhost:8080
INFO     2017-03-14 07:51:36,213 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO     2017-03-14 07:51:45,811 module.py:806] default: "GET /_ah/start HTTP/1.1" 404 -
ERROR    2017-03-14 07:51:45,877 wsgi.py:263] 
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/gemini/gae projects/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/main.py", line 19, in <module>
    import endpoints
  File "/home/gemini/gae projects/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/__init__.py", line 29, in <module>
    from apiserving import *
  File "/home/gemini/gae projects/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/apiserving.py", line 74, in <module>
    from google.api.control import client as control_client
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 1001, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named google.api

I tried creating a seperate virtualenv but the problem still exists.

4

3 Answers 3

5

Here is the reply from a google guy..

Local development with endpoints framework v2 isn't currently supported, you'll need to deploy the app.

https://github.com/GoogleCloudPlatform/python-docs-samples/issues/853

Sign up to request clarification or add additional context in comments.

Comments

4

Your error :

ImportError: No module named google.api

So you need first to install gcloud python module and google-api-python-client module with:

pip install --upgrade gcloud
pip install --upgrade google-api-python-client

from here

1 Comment

Do you able to test endpoints v2 API locally? github.com/GoogleCloudPlatform/python-docs-samples/blob/master/…
1

I had a similar issue with other Google packages in my lib directory. I solved/monkey patched it using the following code in my appengine_config.py file:

import sys
import os
import google
from google.appengine.ext import vendor
lib_directory = os.path.dirname(__file__) + "<relative path to lib dir>"
google.__path__.append(os.path.join(lib_directory, 'google'))
logging.info("importing lib %s" % (lib_directory))
vendor.add(lib_directory)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.