Protobuf: Cannot import descriptor

Created on 8 Jul 2015  路  5Comments  路  Source: protocolbuffers/protobuf

I cannot successfully import descriptor.py.

$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf import descriptor as _descriptor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/protobuf-2.6.1-py2.7.egg/google/protobuf/descriptor.py", line 50, in <module>
    from google.protobuf.pyext import _message
ImportError: cannot import name _message
>>> ^D
$ protoc --version
libprotoc 2.6.1

Running on OSX 10.10.

Most helpful comment

Fixed.

$ pip uninstall protobuf
$ brew install protobuf
$ mkdir -p /Users/alexeibendebury/Library/Python/2.7/lib/python/site-packages
$ echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/alexeibendebury/Library/Python/2.7/lib/python/site-packages/homebrew.pth

All 5 comments

Fixed.

$ pip uninstall protobuf
$ brew install protobuf
$ mkdir -p /Users/alexeibendebury/Library/Python/2.7/lib/python/site-packages
$ echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/alexeibendebury/Library/Python/2.7/lib/python/site-packages/homebrew.pth

Thanks PlasmaSheep. You solved my protobuf problem for both caffe and tensorflow.

This fixed the issue for me as well.

@sara-eb: seems like an unrelated problem, you should open a new issue or try stackoverflow

@abendebury I deleted my question from here. Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blowmage picture blowmage  路  73Comments

blowmage picture blowmage  路  26Comments

lostindark picture lostindark  路  148Comments

laszloagardi picture laszloagardi  路  40Comments

larribas picture larribas  路  48Comments