Sparkofska
Sparkofska

Reputation: 1320

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 :)

Upvotes: 10

Views: 33085

Answers (1)

Dzintars
Dzintars

Reputation: 1571

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

Locate the location of your current protoc binary

which protoc

Delete old version of protoc binary:

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 actual 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 protoc 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.

Upvotes: 17

Related Questions