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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM