Compile Issue

2,149 views
Skip to first unread message

nadine...@gmail.com

unread,
Sep 5, 2012, 7:46:25 AM9/5/12
to nan...@googlegroups.com
When compiling my .proto file with

python nanopb/generator/nanopb_generator.py message.proto

I'm getting the error

*************************************************************
*** Could not import the Google protobuf Python libraries ***
*** Try installing package 'python-protobuf' or similar. ***
*************************************************************

Traceback (most recent call last):
File "nanopb/generator/nanopb_generator.py", line 4, in <module>
import google.protobuf.descriptor_pb2 as descriptor
ImportError: No module named google.protobuf.descriptor_pb2

My protobuf was install with homebrew if this is an issue you are aware of. The Protocol Buffer compiler (`protoc`) is working as it was able to create the `message.pb` file without an error.

Anyone know of what is going on here? I fail to see why it can't find protobuf if I have it installed and linked `brew link protobuf`:

Warning: Already linked: /usr/local/Cellar/protobuf/2.4.1

Petteri Aimonen

unread,
Sep 5, 2012, 9:32:36 AM9/5/12
to nan...@googlegroups.com
Try installing the Python bindings separately: go to the protobuf-2.4.1/python folder, and run "python setup.py install".

After that you should have a folder like /usr/lib/python2.7/dist-packages/google/protobuf and nanopb_generator.py should work.
Reply all
Reply to author
Forward
0 new messages