modxevil / google-cloud-sdk

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

gsutil ImportError: No module named google #538

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Running gsutil.

What is the expected output? What do you see instead?

gsutil
Traceback (most recent call last):
  File "/Users/dberg/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 12, in <module>
    import bootstrapping
  File "/Users/dberg/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 9, in <module>
    import setup
  File "/Users/dberg/google-cloud-sdk/bin/bootstrapping/setup.py", line 42, in <module>
    reload(google)

What is the output of 'gcloud info'?

Google Cloud SDK [96.0.0]

Platform: [Mac OS X, x86_64]
Python Version: [2.7.10 (default, Jul 14 2015, 19:46:27)  [GCC 4.2.1 Compatible 
Apple LLVM 6.0 (clang-600.0.39)]]
Python Location: [/usr/bin/python]
Site Packages: [Disabled]

Installation Root: [/Users/redacted/google-cloud-sdk]
Installed Components:
  core: [2016.02.05]
  core-nix: [2016.02.05]
  gcloud: []
  gsutil-nix: [4.15]
  gsutil: [4.16]
  bq: [2.0.18]
  bq-nix: [2.0.18]
System PATH: 
[/Users/redacted/google-cloud-sdk/bin:/Users/redacted/bin:/Users/redacted/.rvm/g
ems/ruby-2.2.1/bin:/Users/redacted/.rvm/gems/ruby-2.2.1@global/bin:/Users/redact
ed/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/
X11/bin:/Users/redacted/.rvm/bin:/Users/redacted/.rvm/bin]
Cloud SDK on PATH: [True]

Installation Properties: [/Users/redacted/google-cloud-sdk/properties]
User Config Directory: [/Users/redacted/.config/gcloud]
User Properties: [/Users/redacted/.config/gcloud/properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]

Account: [redacted@redacted.com]
Project: [redacted-prod]

Current Properties:
  [core]
    project: [redacted-prod]
    account: [redacted@redacted.com]
    disable_usage_reporting: [False]
  [container]
    cluster: [redacted-cluster-all]
  [compute]
    region: [us-central1]
    zone: [us-central1-a]

Logs Directory: [/Users/redacted/.config/gcloud/logs]
Last Log File: 
[/Users/redacted/.config/gcloud/logs/2016.02.11/12.29.41.415337.log]

Please provide any additional information below.

Original issue reported on code.google.com by db...@kabaminc.com on 11 Feb 2016 at 8:34

GoogleCodeExporter commented 8 years ago
Thank you for reporting the issue. 

You can work around the issue by removing offending line in the file:
google-cloud-sdk/bin/bootstrapping/setup.py line 42

Do you have some other google python package installed on your machine?

Original comment by che...@google.com on 11 Feb 2016 at 11:57

GoogleCodeExporter commented 8 years ago
I don't think I have another google python package installed.

As a workaround I installed gsutil from here 
https://cloud.google.com/storage/docs/gsutil_install and gave it priority on my 
path lookup.

Original comment by db...@kabaminc.com on 12 Feb 2016 at 12:27

GoogleCodeExporter commented 8 years ago
Great you found a way.

If you don't mind can you run this:
  python -c 'import google;print google.__file__'
and report its output for your installation.

Original comment by che...@google.com on 12 Feb 2016 at 12:41

GoogleCodeExporter commented 8 years ago
python -c 'import google;print google.__file__'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__file__'

Original comment by db...@kabaminc.com on 12 Feb 2016 at 12:44

GoogleCodeExporter commented 8 years ago
I had the same issue. Running 
    python -c 'import google;print google.__path__' 
showed
    ~/anaconda/lib/python2.7/site-packages/google

Original comment by kevi...@google.com on 12 Feb 2016 at 8:47

GoogleCodeExporter commented 8 years ago
As a workaround installation can be patched via:
sed -i "s/'google' in sys.modules/False/" $(gcloud info 
--format='value(installation.sdk_root)')/bin/bootstrapping/setup.py

or creating a file in 
touch $(gcloud info 
--format='value(installation.sdk_root)')/lib/third_party/google.py

Original comment by che...@google.com on 12 Feb 2016 at 6:21

GoogleCodeExporter commented 8 years ago
The __path__ attribute showed the problem:

/Library/Python/2.7/site-packages/google

Which contains protobuf.

/Library/Python/2.7/site-packages/google/protobuf

Original comment by db...@kabaminc.com on 15 Feb 2016 at 6:38

GoogleCodeExporter commented 8 years ago
thank you for  posting this, saved my time

Original comment by vitaliy....@gmail.com on 16 Feb 2016 at 11:57

GoogleCodeExporter commented 8 years ago
This issue will be fixed in the Cloud SDK 98.0.0 release.

Original comment by z...@google.com on 16 Feb 2016 at 6:51