I'm trying to train a Caffe model. My .prototxt file uses custom Python Data and Loss layers.python
When I execute the training command in terminal, however, this error is raised:git
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.2.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/descriptor.pb.cc".) terminate called after throwing an instance of 'google::protobuf::FatalException'
经过问题的前几行发现问题主要出在Protocol Buffer上,说是版本过低,升级库的版本能够解决。千万不要升级,只会在这上面浪费时间,具体可参考网址。github
主要是由于caffe编译的时候默认的protobuf的版本是2.6.1,而Python经过pip install protobuf 安装的版本是最新版本3.4.0!python2.7
而在caffe环境中咱们必须统一ProtoBuffer的版本才能够避免各类不易排查的错误!!
为此,咱们先卸载Python的版本ProtoBuffer,再从新安装2.6.1的版本就完美的解决了这个问题。
操做:ui
sudo pip uninstall protobufthis
而后再从新安装:google
sudo pip install protobuf==2.6.1code
但还没完:虽然python3变了,但2没变,而这里使用2的环境blog
/usr/local/lib/python3.5/dist-packages中的protobuf:ip
/usr/local/lib/python2.7/dist-packages中的protobbuf
因此:sudo pip2 uninstall protobuf
sudo pip2 install protobuf==2.6.1