Protobuf 版本不匹配
Protobuf version mismatch
我目前在 tensorflow 中使用 RNN 时遇到此错误:
[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".)
但是当我检查版本时:
$ 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
您可能安装了两个不同版本的 protobuf。
检查
protoc --version
如果与3.4.0不同。您可能需要卸载它。
我猜你正在链接一个使用不同库的 C++ 程序。如果这些库是使用不同版本的 protobuf 构建的,则会导致此问题。使用相同版本的 protobuf 重建所有库(包括 tf)。
除了使用
检查你的协议版本
protoc --version
确保您的系统中没有其他协议使用
which protoc
按照以下步骤操作:
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 && \
如果您收到以下 cmake 警告:
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)
然后执行以下命令:
sudo apt-get remove libprotobuf-dev
抑制cmake警告
find_package(Protobuf CONFIG REQUIRED)
我目前在 tensorflow 中使用 RNN 时遇到此错误:
[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".)
但是当我检查版本时:
$ 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
您可能安装了两个不同版本的 protobuf。 检查
protoc --version
如果与3.4.0不同。您可能需要卸载它。
我猜你正在链接一个使用不同库的 C++ 程序。如果这些库是使用不同版本的 protobuf 构建的,则会导致此问题。使用相同版本的 protobuf 重建所有库(包括 tf)。
除了使用
检查你的协议版本protoc --version
确保您的系统中没有其他协议使用
which protoc
按照以下步骤操作:
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 && \
如果您收到以下 cmake 警告:
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)
然后执行以下命令:
sudo apt-get remove libprotobuf-dev
抑制cmake警告
find_package(Protobuf CONFIG REQUIRED)