This program requires version 3.3.0 of the Protocol Buffer runtime library #5711

Open
thomy800 opened this Issue Jun 23, 2017 · 14 comments

Comments

Projects
None yet
5 participants

Hi. I installed caffe as described on https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide. I set WITH_PYTHON_LAYER := 1. Caffe runs fine except when I am trying to load a python layer. It then complains:
I0621 13:38:52.346406 21139 layer_factory.hpp:77] Creating layer data
2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609]
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.3.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.3.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 1498045132 (unix time) try "date -d @1498045132" if you are using GNU date ***
PC: @ 0x7f48153ec428 gsignal
*** SIGABRT (@0x3e800005293) received by PID 21139 (TID 0x7f4818061ac0) from PID 21139; stack trace: ***
@ 0x7f48153ec4b0 (unknown)
@ 0x7f48153ec428 gsignal
@ 0x7f48153ee02a abort
@ 0x7f481620084d __gnu_cxx::__verbose_terminate_handler()
@ 0x7f48161fe6b6 (unknown)
@ 0x7f48161fe701 std::terminate()
@ 0x7f48161fe919 __cxa_throw
@ 0x7f4816744647 google::protobuf::internal::LogMessage::Finish()
@ 0x7f481674487d google::protobuf::internal::VerifyVersion()
@ 0x7f47e177de34 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct::InitDefaultsImpl()
@ 0x7f4816744f75 google::protobuf::GoogleOnceInitImpl()
@ 0x7f47e1779475 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults()
@ 0x7f47e17794a9 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptorsImpl()
@ 0x7f4816744f75 google::protobuf::GoogleOnceInitImpl()
@ 0x7f47e1779525 google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors()
@ 0x7f4817ed26ba (unknown)
@ 0x7f4817ed27cb (unknown)
@ 0x7f4817ed78e2 (unknown)
@ 0x7f4817ed2564 (unknown)
@ 0x7f4817ed6da9 (unknown)
@ 0x7f48032abf09 (unknown)
@ 0x7f4817ed2564 (unknown)
@ 0x7f48032ac571 (unknown)
@ 0x7f48032abfa1 dlopen
@ 0x7f4815a7488d _PyImport_GetDynLoadFunc
@ 0x7f4815ae34be _PyImport_LoadDynamicModule
@ 0x7f4815ae4300 (unknown)
@ 0x7f4815ae45c8 (unknown)
@ 0x7f4815ae56db PyImport_ImportModuleLevel
@ 0x7f4815a5c698 (unknown)
@ 0x7f4815aa81e3 PyObject_Call
@ 0x7f4815b7e447 PyEval_CallObjectWithKeywords
./train.sh: line 1: 21139 Aborted

I investigated three possible packages:
1] pips protobuf: originally 2.6 was installed. I changed to 3.3.0, recompiled caffe, still the same problem
2] libprotobuf-dev: it claims to be libprotobuf10 amd64 3.1.0
3] protobuf-compiler: it claims to be 2.6.1-1.3, a web search suggested there is currently a version maximum of 3.1.0

Any advice is highly appreciated.
Cheers,
Thomy800

Have you solved this problem?

thomy800 commented Jul 3, 2017

Unfortunately not...

This problem seems not caused by caffe, since i used to run caffe on protoc 2.6.1

I got this problem after install tensorflow, ant not solved

aalennku commented Jul 11, 2017 edited

Hey, the problem is solved by uninstalling the protobuf (version 3.3) :
pip2 uninstall protobuf
pip3 uninstall protobuf

至于 这么干以后tensorflow会不会崩,今朝有酒今朝醉吧。

Uninstalling didn't work for me:

I0711 09:52:17.679932 10729 layer_factory.hpp:77] Creating layer data
Traceback (most recent call last):
File "/home/.../test.py", line 1, in
import caffe
File ".../caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File ".../caffe/pycaffe.py", line 15, in
import caffe.io
File ".../caffe/io.py", line 8, in
from caffe.proto import caffe_pb2
File ".../caffe/proto/caffe_pb2.py", line 6, in
from google.protobuf.internal import enum_type_wrapper
ImportError: No module named protobuf.internal

Contributor

jasjuang commented Jul 19, 2017

sudo pip install protobuf solves it for me

VitoChien commented Jul 30, 2017 edited

This problem should be caused by the old version of lib installed by apt-get. Try to do
sudo apt-get remove --purge libprotobuf-dev

What I did:

sudo apt-get remove --purge libprotobuf-dev
sudo apt-get install libprotobuf-dev
cd caffe-root-path
make clean
make all -j8
make pycaffe

The warning changed a bit:

This program requires version 3.3.0 of the Protocol Buffer runtime library, but the installed version is 3.1.0. 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".)

So instead of 2.6.1 I now have 3.1.0 installed. However protobuf does not seem to be satisfied. I was looking for 3.3.0 and found this. But I could not install it:

sudo add-apt-repository ppa:maarten-fonville/protobuf
sudo apt-get update
sudo apt-get install libprotobuf-dev=3.3.0

E: Version ‘3.3.0’ for ‘libprotobuf-dev’ was not found

So.. still no protobuf 3.3.0...

VitoChien commented Jul 31, 2017 edited

@thomy800
What happened is that the repository that your apt-get gets things from doesn't have the protobuf 3.3.0. I advise you to build protobuf from source.Here is the link.
https://github.com/google/protobuf/tree/master/src
It seems that click on the url doesn't guide to the page.Just copy it and paste it on the browser address bar and open it.

Well I did as you suggested. I installed from source, however it seems to be version 3.3.2. I am not sure, though.
Anyway, when I am trying to compile caffe again, caffe failes to handle the new protobuf:

sudo make all
PROTOC src/caffe/proto/caffe.proto
protoc: error while loading shared libraries: libprotoc.so.13: cannot open shared object file: No such file or directory
Makefile:638: recipe for target '.build_release/src/caffe/proto/caffe.pb.cc' failed
make: *** [.build_release/src/caffe/proto/caffe.pb.cc] Error 127

VitoChien commented Jul 31, 2017 edited

@thomy800
If you followed all steps in the Installation and did the last step in the it.which is
sudo ldconfig # refresh shared library cache

Then the problem should be that the path where the lib is is not included in the Makefile.config. Follow these steps:

  1. open a terminal and input:
    sudo find / -name "libprotoc.so.13"

this will list the libprotoc.so.13 file existing in your computer.Ignore the one that in the path that built the source, I got this in my computer:

/usr/local/lib/libprotoc.so.13

  1. Edit Makefile.config. Add the path that you got in the previous step in the LIBRARY_DIRS. For me , I added the '/usr/local/lib/'

3.Try to make it again.

sudo ldconfig
was missing. I rebuild caffe. Next error:

I0731 13:51:12.636873 17780 layer_factory.hpp:77] Creating layer loss
*** Aborted at 1501501873 (unix time) try "date -d @1501501873" if you are using GNU date ***
PC: @ 0x7f2d417d3b73 std::_Hashtable<>::clear()
*** SIGSEGV (@0x9) received by PID 17780 (TID 0x7f2d78255ac0) from PID 9; stack trace: ***
@ 0x7f2d754964b0 (unknown)
@ 0x7f2d417d3b73 std::_Hashtable<>::clear()
@ 0x7f2d417c4ca6 google::protobuf::DescriptorPool::FindFileByName()
@ 0x7f2d417a1dc8 google::protobuf::python::cdescriptor_pool::AddSerializedFile()
@ 0x7f2d75b007d0 PyEval_EvalFrameEx
@ 0x7f2d75c2901c PyEval_EvalCodeEx
@ 0x7f2d75b7f3dd (unknown)
@ 0x7f2d75b521e3 PyObject_Call
@ 0x7f2d75b72ae5 (unknown)
@ 0x7f2d75b09123 (unknown)
@ 0x7f2d75b521e3 PyObject_Call
@ 0x7f2d75afd13c PyEval_EvalFrameEx
@ 0x7f2d75c2901c PyEval_EvalCodeEx
@ 0x7f2d75af7b89 PyEval_EvalCode
@ 0x7f2d75b8c1b4 PyImport_ExecCodeModuleEx
@ 0x7f2d75b8cb8f (unknown)
@ 0x7f2d75b8e300 (unknown)
@ 0x7f2d75b8e5c8 (unknown)
@ 0x7f2d75b8f6db PyImport_ImportModuleLevel
@ 0x7f2d75b06698 (unknown)
@ 0x7f2d75b521e3 PyObject_Call
@ 0x7f2d75c28447 PyEval_CallObjectWithKeywords
@ 0x7f2d75afb5c6 PyEval_EvalFrameEx
@ 0x7f2d75c2901c PyEval_EvalCodeEx
@ 0x7f2d75af7b89 PyEval_EvalCode
@ 0x7f2d75b8c1b4 PyImport_ExecCodeModuleEx
@ 0x7f2d75b8cb8f (unknown)
@ 0x7f2d75b8e300 (unknown)
@ 0x7f2d75b8e5c8 (unknown)
@ 0x7f2d75b8f6db PyImport_ImportModuleLevel
@ 0x7f2d75b06698 (unknown)
@ 0x7f2d75b521e3 PyObject_Call
./train.sh: line 8: 17780 Segmentation fault (core dumped)

VitoChien commented Jul 31, 2017 edited

@thomy800 I've never met the problem before. I guess it may be caused by the higher version of protobuf. Try to build the v3.3.0 version. There are steps that you can switch the version:
git clone --recursive https://github.com/google/protobuf
cd ./protobuf
git checkout v3.3.0
then redo the steps in the installation.

May you need wait for another solution or google it if this help nothing.

Well, I did so:

protoc --version
libprotoc 3.3.0

However, still the same error:

I0731 15:34:01.122179 19043 layer_factory.hpp:77] Creating layer loss
*** Aborted at 1501508041 (unix time) try "date -d @1501508041" if you are using GNU date ***
PC: @ 0x7f0b345a4b73 std::_Hashtable<>::clear()
*** SIGSEGV (@0x9) received by PID 19043 (TID 0x7f0b6b021ac0) from PID 9; stack trace: ***
@ 0x7f0b682674b0 (unknown)
@ 0x7f0b345a4b73 std::_Hashtable<>::clear()
@ 0x7f0b34595ca6 google::protobuf::DescriptorPool::FindFileByName()
@ 0x7f0b34572dc8 google::protobuf::python::cdescriptor_pool::AddSerializedFile()
@ 0x7f0b688d17d0 PyEval_EvalFrameEx
@ 0x7f0b689fa01c PyEval_EvalCodeEx
...

It really looked promising, but now it's getting annoying...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment