Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting of google packages #853

Closed
Avinash-Raj opened this issue Mar 15, 2017 · 9 comments
Closed

Conflicting of google packages #853

Avinash-Raj opened this issue Mar 15, 2017 · 9 comments

Comments

@Avinash-Raj
Copy link

Avinash-Raj commented Mar 15, 2017

In which file did you encounter the issue?

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/endpoints-frameworks-v2/echo/main.py

Did you change the file? If so, how?

No, I didn't change the source file.

Describe the issue

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 framework package.

Here comes the full traceback.

$ 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
@theacodes
Copy link
Contributor

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

@Avinash-Raj
Copy link
Author

Avinash-Raj commented Mar 16, 2017

@jonparrott I can't able to generate OpenApi configuration. I don't know why endpoints v2 choose an already existsing package named google .

$ python lib/endpoints/endpointscfg.py get_openapi_spec api.StoryBoxApi --hostname storybox-api.endpoints.storybox-backend.appspot.com
Traceback (most recent call last):
  File "lib/endpoints/endpointscfg.py", line 633, in <module>
    main(sys.argv)
  File "lib/endpoints/endpointscfg.py", line 629, in main
    args.callback(args)
  File "lib/endpoints/endpointscfg.py", line 487, in _GenOpenApiSpecCallback
    application_path=args.application)
  File "lib/endpoints/endpointscfg.py", line 332, in _GenOpenApiSpec
    application_path=application_path)
  File "lib/endpoints/endpointscfg.py", line 183, in GenApiConfig
    module = __import__(module_name, fromlist=base_service_class_name)
  File "/home/gemini/projects/storybox-backend/src/api/__init__.py", line 19, in <module>
    import endpoints
  File "/home/gemini/projects/storybox-backend/src/lib/endpoints/__init__.py", line 29, in <module>
    from apiserving import *
  File "/home/gemini/projects/storybox-backend/src/lib/endpoints/apiserving.py", line 74, in <module>
    from google.api.control import client as control_client
ImportError: No module named control

I wondered why there is a different error than the previous one. So I get into this lib/endpoinst/apiserving.py file and add these two line

import google.api
print google.api.__file__ 

before from google.api.control import client as control_client and after executing the OpenAPI command , I got this output.

/usr/local/lib/python2.7/dist-packages/google/api/__init__.pyc

So there is another google package installed on my pc.

Ok, whatever it is, I should get the same original error if I try to generate OpenAPI config file.

@theacodes
Copy link
Contributor

Yep, so I would recommend activating an empty virtualenv before running endpointscfg.py so that your system packages don't cause issues.

@Avinash-Raj
Copy link
Author

Now, it works .. Thanks :-)

@Avinash-Raj
Copy link
Author

@jonparrott I think local development of endpoints v2 framework was supported now https://cloud.google.com/appengine/docs/standard/python/endpoints/test_deploy . pls let me know how to resolve the original traceback?

@theacodes
Copy link
Contributor

@Avinash-Raj I suggest filing an issue over on https://github.com/cloudendpoints/endpoints-python

@paynen0
Copy link

paynen0 commented Apr 11, 2017

@Avinash-Raj: The link you provided refers to endpoints v1...

@Avinash-Raj
Copy link
Author

Avinash-Raj commented Apr 12, 2017 via email

@mritchie712
Copy link

Any progress on making endpoints V2 available locally? Deploying a GAE takes several minutes which really slows down the development cycle if I need to deploy every time I make a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants