Protobuf version mismatch

Viewed 36193

I'm currently getting this error using RNN in tensorflow:

[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 "bazel-out/local_linux-opt/genfiles/tensorflow/contrib/tensor_forest/proto/fertile_stats.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 "bazel-out/local_linux-opt/genfiles/tensorflow/contrib/tensor_forest/proto/fertile_stats.pb.cc".)

But when I check the version:

$ pip show protobuf
Name: protobuf
Version: 3.4.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf@googlegroups.com
Author-email: protobuf@googlegroups.com
License: 3-Clause BSD License
Location: /usr/local/lib/python2.7/dist-packages
Requires: six, setuptools
4 Answers

You might have two different versions of protobuf installed. Check

protoc --version

If it is different from 3.4.0. You might need to uninstall it.

Follow the steps below:

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz -O /tmp/protobuf-all-3.17.3.tar.gz && \
tar xzvf /tmp/protobuf-all-3.17.3.tar.gz && \
cd protobuf-3.17.3 && \
mkdir build && \
cd build && \
cmake ../cmake && \
make && \
sudo make install && \

If you are getting the below cmake warning:

CMake Warning at /usr/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message): Protobuf compiler version 3.0.0 doesn't match library version 3.17.3 Call Stack (most recent call first): CMakeLists.txt:6 (find_package)

Then follow the below command:

sudo apt-get remove libprotobuf-dev

Suppress cmake warning

find_package(Protobuf CONFIG REQUIRED)

Guess you are linking a c++ program using different libs. If these libs are built using with different version of protobuf, it will cause this problem. Rebuild all the libs (including tf) using the same version of protobuf.

Apart from checking your protoc version using

protoc --version

making sure that you don't have another protoc in your system using

which protoc
Related