gana2188 / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
0 stars 0 forks source link

Google Cloud SDK and Google Datastore Coexistence Error #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install the google datastore library into a virtualenv with a functional 
google cloud SDK
2. Try to use gcloud (receive error)
3. Remove datastore and dependencies and try again (it should then work)

What is the expected output? What do you see instead?
I'm trying to use the google datastore python libraries.  It breaks the cloud 
SDK.

What version of the product are you using? On what operating system?
1.9.0 of the google cloud sdk, Mac OSX 10.9, CentOS 6.5, and cygwin.

Please provide any additional information below.

If I install the google_cloud_sdk 1.9.0 and the google cloud datastore beta 
code for python 2.7 in the same environment, the SDK gives the following error 
when using gcloud:

~>gcloud
Traceback (most recent call last):
  File "/cygdrive/d/Dropbox/Workspace/apps/Google/google-cloud-sdk/bin/../lib/google/cloud/sdk/gcloud/gcloud.py", line 51, in <module>
    _DoStartupChecks()
  File "/cygdrive/d/Dropbox/Workspace/apps/Google/google-cloud-sdk/bin/../lib/google/cloud/sdk/gcloud/gcloud.py", line 44, in _DoStartupChecks
    from google.cloud.sdk.core.util import platforms
ImportError: No module named cloud.sdk.core.util

~>pip list
distribute (0.6.34)
googledatastore (v1beta2-rev1-2.1.0)
httplib2 (0.8)
oauth2client (1.2)
protobuf (2.5.0)
simplejson (3.3.3)
uritemplate (0.6)
wsgiref (0.1.2)

This happens on my Mac 10.9, CentOS 6.5, and Cygwin windows environments.  The 
datastore code was installed in a virtualenv in these environments using 
(https://github.com/GoogleCloudPlatform/google-cloud-datastore):

pip install --pre googledatastore

Within the virtual environment it installs 
"~/virtualenvs/py27/lib/python2.7/site-packages/google/protobuf".  Since the 
datastore installs a "google" lib and the SDK has a "google" lib it splits the 
namespace.  This means the SDK is looking at the datastore's google library and 
not its own; it doesn't find "google.cloud.sdk.core.util" because it's in a 
different location.  I believe this explains how to fix the issue:

http://stackoverflow.com/questions/1675734/how-do-i-create-a-namespace-package-i
n-python

I would assume at some point the datastore library would be part of the cloud 
SDK, but today it is separate and doesn't seem to play well with others...

Original issue reported on code.google.com by james.m....@gmail.com on 31 Mar 2014 at 8:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
We'll take a look at this one. Sorry about the delay.

Original comment by rdayal@google.com on 15 Aug 2014 at 8:47

GoogleCodeExporter commented 9 years ago
Unfortunately, this is a problem fundamental to how Python loads modules.  Once 
a google module is loaded (like google/protobuf) no other google module will be 
discovered (like google/cloud/sdk).  To get around this, we renamed our package 
root to 'googlecloudsdk' so as not to conflict with other google packages.  
This change was made a while ago, so this should not longer be an issue.  
Please re-open if you are still having problems.

Original comment by markp...@google.com on 15 Aug 2014 at 8:49

GoogleCodeExporter commented 9 years ago

Original comment by palla...@google.com on 18 Aug 2014 at 1:58