Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Protobuf Runtime Library?

My Issue

I am struggeling with this error:

[libprotobuf FATAL google/protobuf/stubs/common.cc:67]
This program requires version 3.4.0 of the Protocol Buffer runtime library,
but the installed version is 3.0.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 "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'

It is obviously telling me to update the 'Protobuf runtime library', but I have no clue how to accomplish that. Can anybody please help me on that?

I did not compile tensorflow myself, nor am I planning to do that.

My Context

I am in a python script, attempting to train a tensorflow model by the keras library; This line is causing the error:

keras.callbacks.TensorBoard(log_dir=self.log_dir, histogram_freq=0, write_graph=True, write_images=False)

Running on Ubuntu 17.10 artful

Here I share the output of some commands, that I used while trying to debug:

(venv) $ pip show protobuf                          
  Name: protobuf           
  Version: 3.6.1           
  Summary: Protocol Buffers

Also protoc is fine (but I need the 'runtime library', which is different from the 'compiler', I guess)

$ protoc --version                                   
  libprotoc 3.6.1
$ which protoc
  /usr/local/bin/protoc

My Attempts

The default package by apt is libprotobuf10 (Version: 3.0.0). So I installed a newer version from here https://launchpad.net/~maarten-fonville/+archive/ubuntu/protobuf without any changes in the error message

$ sudo add-apt-repository ppa:maarten-fonville/protobuf
$ sudo apt update
$ sudo apt install libprotobuf15 # Version: 3.5.2
$ sudo apt install libprotobuf12 # Version: 3.4.1

I don't dare to apt remove libprotobuf10, because it will also remove gnome-shell, ubuntu-desktop, ... which sounds kinda dangerous.

Any ideas appreciated :)

like image 839
Sparkofska Avatar asked Aug 27 '18 13:08

Sparkofska


People also ask

How do I update Google protobuf?

After you moved protoc file to /usr/local/bin check its permissions as simple as ls -la /usr/local/bin and look for that protoc file. Probably you want to do sudo chown root:root /usr/local/bin/protoc . UPDATE: Same applies to /usr/local/include/google/protobuf/* if you are using gRPC.

How do I check protobuf version?

To check which version of protobuf is installed, use pip show protobuf or pip3 show protobuf in your CMD/Powershell (Windows), or terminal (macOS/Linux/Ubuntu) to obtain the output major.

What is protobuf lib?

Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs to communicate with each other over a network or for storing data.

Does Google use protobuf?

Protocol buffers, or Protobuf, is a binary format created by Google to serialize data between different services. Google made this protocol open source and now it provides support, out of the box, to the most common languages, like JavaScript, Java, C#, Ruby and others.


1 Answers

Have you tried to delete old protoc binary and replace it with new one?

Delete old version of protoc:

$ sudo rm /usr/local/bin/protoc

Download latest or required version of protoc. For example Protocol Buffers v3.9.1

Extract it somewhere you like.

Copy protoc-3.9.1-linux-x86_64/bin/protoc binary back to /usr/local/bin. That protoc file is the binary you want.

sudo mv /location/of/protoc-3.9.1-linux-x86_64/bin/protoc /usr/local/bin

After you moved protoc file to /usr/local/bin check its permissions as simple as ls -la /usr/local/bin and look for that protoc file. Probably you want to do sudo chown root:root /usr/local/bin/protoc.

It should be executable by default, but if in some strange case it is not, then probably you want to do sudo chmod +x /usr/local/bin/protoc

Check version now protoc --version

UPDATE: Same applies to /usr/local/include/google/protobuf/* if you are using gRPC. If you are updating protoc compiler, then you should update those proto files as well. They change rarely, but... you never know.

like image 197
Dzintars Avatar answered Oct 01 '22 01:10

Dzintars