This program requires version 3.4.0 of the Protocol Buffer runtime library

This program requires version 3.3.0 of the Protocol Buffer runtime library

此问题处理主要参考This program requires version 3.3.0 of the Protocol Buffer runtime library

问题描述

在安装好caffe之后,想要运行自己的数据集,因此使用了Python写了数据的输入层,但是当运行的时候确报错:

I1014 12:10:10.685569 11452 layer_factory.hpp:77] Creating layer Data
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.4.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'
  what():  This program requires version 3.4.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".)
*** Aborted at 1507954211 (unix time) try "date -d @1507954211" if you are using GNU date ***
PC: @     0x7ff1a8036428 gsignal
*** SIGABRT (@0x3e800002cbc) received by PID 11452 (TID 0x7ff1aa1f0ac0) from PID 11452; stack trace: ***
    @     0x7ff1a80364b0 (unknown)
    @     0x7ff1a8036428 gsignal
    @     0x7ff1a803802a abort
    @     0x7ff1a8e4a84d __gnu_cxx::__verbose_terminate_handler()
    @     0x7ff1a8e486b6 (unknown)
    @     0x7ff1a8e48701 std::terminate()
    @     0x7ff1a8e48919 __cxa_throw
    @     0x7ff1a938e647 google::protobuf::internal::LogMessage::Finish()
    @     0x7ff1a938e87d google::protobuf::internal::VerifyVersion()
    @     0x7ff16f8b0754 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct::InitDefaultsImpl()
    @     0x7ff1a938ef75 google::protobuf::GoogleOnceInitImpl()
    @     0x7ff16f8abae5 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults()
    @     0x7ff16f8abb19 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::(anonymous namespace)::AddDescriptorsImpl()
    @     0x7ff1a938ef75 google::protobuf::GoogleOnceInitImpl()
    @     0x7ff16f8abb95 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors()
    @     0x7ff1aa0636ba (unknown)
    @     0x7ff1aa0637cb (unknown)
    @     0x7ff1aa0688e2 (unknown)
    @     0x7ff1aa063564 (unknown)
    @     0x7ff1aa067da9 (unknown)
    @     0x7ff1a5a30f09 (unknown)
    @     0x7ff1aa063564 (unknown)
    @     0x7ff1a5a31571 (unknown)
    @     0x7ff1a5a30fa1 dlopen
    @     0x7ff1a86be88d _PyImport_GetDynLoadFunc
    @     0x7ff1a872d4be _PyImport_LoadDynamicModule
    @     0x7ff1a872e300 (unknown)
    @     0x7ff1a872e5c8 (unknown)
    @     0x7ff1a872f6db PyImport_ImportModuleLevel
    @     0x7ff1a86a6698 (unknown)
    @     0x7ff1a86f21e3 PyObject_Call
    @     0x7ff1a87c8447 PyEval_CallObjectWithKeywords
Aborted (core dumped)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41

通过问题的前几行发现问题主要出在Protocol Buffer上,说是版本太低,升级库的版本可以解决。千万不要升级,只会在这上面浪费时间,具体可参考网址。

问题原因

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

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

pip uninstall protobuf

E470:~/caffe$ pip uninstall protobuf
Uninstalling protobuf-3.4.0:
  /usr/local/lib/python2.7/dist-packages/google/protobuf/__init__.py
  /usr/local/lib/python2.7/dist-packages/google/protobuf/__init__.pyc
  .......
  Proceed (y/n)? y
  Successfully uninstalled protobuf-3.4.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

然后再重新安装:

pip install protobuf==2.6.1

解决!

PS: 
ProtoBuffer 是由Google开发的一种可以实现内存与非易失存储介质(如硬盘文件)交换的协议接口。 
具体知识可参考《深度学习21天实战Caffe》

你可能感兴趣的:(图像处理检测)