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.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

相關文章
相關標籤/搜索