This program requires version 3.4.0 of the Protocol Buffer runtime library

I'm trying to train a Caffe model. My .prototxt file uses custom Python Data and Loss layers.

When I execute the training command in terminal, however, this error is raised:

[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上,说是版本太低,升级库的版本可以解决。千万不要升级,只会在这上面浪费时间,具体可参考网址

问题原因

主要是因为caffe编译的时候默认的protobuf的版本是2.6.1,而Python通过pip install protobuf 安装的版本是最新版本3.4.0!

而在caffe环境中我们必须统一ProtoBuffer的版本才可以避免各种不易排查的错误!! 
为此,我们先卸载Python的版本ProtoBuffer,再重新安装2.6.1的版本就完美的解决了这个问题。 
操作:

sudo pip uninstall protobuf

然后再重新安装:

sudo pip install protobuf==2.6.1

 

但还没完:虽然python3变了,但2没变,而这里使用2的环境

/usr/local/lib/python3.5/dist-packages中的protobuf:

 

/usr/local/lib/python2.7/dist-packages中的protobbuf

 

所以:sudo pip2 uninstall protobuf

sudo pip2 install protobuf==2.6.1

posted on 2017-12-28 11:26  MissSimple  阅读(4254)  评论(0编辑  收藏  举报

导航