Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing caffe results in ImportError: "No module named google.protobuf.internal" (import enum_type_wrapper)

I installed Anaconda Python on my machine. When I start the Python Interpreter and type "import caffe" in the Python shell, I get the following error:

ImportError: No module named google.protobuf.internal

I have the following files:

wire_format_lite_inl.h
wire_format_lite.h
wire_format.h
unknown_field_set.h
text_format.h
service.h
repeated_field.h
reflection_ops.h
message_lite.h
message.h
generated_message_util.h
extension_set.h
descriptor.proto
descriptor.h
generated_message_reflection.h
generated_enum_reflection.h
dynamic_message.h
descriptor.pb.h
descriptor_database.h

What files do I need so the import will work? Is there an "internal.h" file that is required?

like image 615
PyNerd Avatar asked Jun 06 '16 20:06

PyNerd


2 Answers

This is probably because you have two python environments in your machine, the one provided by your linux distribution(pip) and the other by the anaconda environment (/home/username/anaconda2/bin/pip).

Try installing protobuf for both environments to be sure

pip install protobuf

/home/username/anaconda2/bin/pip install protobuf

like image 171
Jayant Agrawal Avatar answered Nov 06 '22 17:11

Jayant Agrawal


If you are using Ubuntu, try installing protobuf using

sudo apt-get install protobuf

It solved the same problem that I faced.

like image 45
Michael Jaison G Avatar answered Nov 06 '22 18:11

Michael Jaison G