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

grpc python installed with virtualenv, code complains no google.protobuf found on Mac OS X #71

Open
awakenrz opened this issue Nov 13, 2015 · 3 comments

Comments

@awakenrz
Copy link

hmm. I installed my grpc with
$ brew tap grpc
$ brew install grpc/grpc

Then I tried to install grpc python with
$ sudo pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ curl -fsSL https://goo.gl/getgrpc | bash -s python

No error happened, but when I try to import google.protobuf in my python code, it complains google.protobuf cannot be found.

I'm able to
from grpc.beta import implementations
But the following line gives an error:
from google.protobuf import descriptor as _descriptor
ImportError: No module named google.protobuf

@awakenrz awakenrz changed the title grpc python installed with virtualenv, code complains no google.protobuf found. grpc python installed with virtualenv, code complains no google.protobuf found on Mac OS X Nov 13, 2015
@soltanmm
Copy link

@tbetbetbe Is brew-install supposed to check for and pull in dependencies? If so, should proto3 have a brew-thing?

@eonezhang
Copy link

I've also encountered this issue.

brew install grpc/grpc/google-protobuf
==> Installing google-protobuf from grpc/grpc
==> Downloading https://github.com/google/protobuf/archive/v3.0.0.tar.gz
Already downloaded: /Users/ezhang6/Library/Caches/Homebrew/google-protobuf-3.0.0.tar.gz
==> ./autogen.sh
Last 15 lines from /Users/ezhang6/Library/Logs/Homebrew/google-protobuf/01.autogen.sh:
2016-08-29 18:37:10 +0800

./autogen.sh

Google Mock not present. Fetching gmock-1.7.0 from the web...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1582 100 1582 0 0 686 0 0:00:02 0:00:02 --:--:-- 687
[gmock-1.7.0.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of gmock-1.7.0.zip or
gmock-1.7.0.zip.zip, and cannot find gmock-1.7.0.zip.ZIP, period.

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/brew):
https://github.com/grpc/homebrew-grpc/issues

These open issues may also help:
grpc python installed with virtualenv, code complains no google.protobuf found on Mac OS X #71

@hasIan
Copy link

hasIan commented Aug 31, 2016

I just encountered the same problem you described, @eonezhang. The problem with the autogen.sh is that the curl invocation that is attempting to pull gmock is getting a 404. Gmock is available on Github, though, so I tried changing autogen.sh like so:

-- autogen.sh   2016-07-27 14:40:30.000000000 -0700
+++ autogen.fixed.sh    2016-08-31 01:21:44.000000000 -0700
@@ -31,10 +31,10 @@
 # directory is set up as an SVN external.
 if test ! -e gmock; then
   echo "Google Mock not present.  Fetching gmock-1.7.0 from the web..."
-  curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
+  curl $curlopts -L -o gmock-1.7.0.zip https://github.com/google/googlemock/archive/release-1.7.0.zip
   unzip -q gmock-1.7.0.zip
   rm gmock-1.7.0.zip
-  mv gmock-1.7.0 gmock
+  mv googlemock-release-1.7.0 gmock
 fi

This got me past the error above. However, since I'm messing with the contents of the protobuf tarball directly, this is a protobuf issue, not a Homebrew issue. Protobuf itself has been fixed, but this change is not contained in a released version yet.

If you are willing to brew install google-protobuf --HEAD, though, it will install successfully. Alternatively, you can temporarily avoid using Homebrew for protobuf and download the binary installation from Github and just install this into your /usr/local hierarchy until a new version is released with the fix and it gets picked up by Homebrew.

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