google-cloud-python: pip install gcloud causes python to raise errors

(using a fresh conda env to demonstrate):

conda create -n gcloud-test python=3 -y
source activate gcloud-test
pip install gcloud
python -c "print('hello world')" 

output:

Error processing line 2 of /Users/jlowin/anaconda/envs/gcloud-test/lib/python3.5/site-packages/googleapis_common_protos-1.1.0-py3.5-nspkg.pth:

  Traceback (most recent call last):
    File "/Users/jlowin/anaconda/envs/gcloud-test/lib/python3.5/site.py", line 167, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  KeyError: 'google'

Remainder of file ignored
hello world

After some trial and error, it looks like the current version of protobuf (3.0.0b2.post1) is causing the problem. Based on the solution to #1304, reverting to a prior version resolves it (or at least suppresses the error):

pip install protobuf==3.0.0b1.post2
python -c "print('hello world')" 

clean up:

source deactivate
conda env remove -n gcloud-test -y

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 20 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I encountered this problem and it was caused by having https://pypi.python.org/pypi/google installed.

Removing this package and reinstall’ing google-cloud resolved the issue (I verified this by reinstalling ‘google’ and the problem regressed).

Glad to hear it’s working!