Search code examples
pythonpipprotocol-bufferscaffepycaffe

This program requires version 3.2.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1


I'm trying to train a Caffe model. My .prototxt file uses custom Python Data and Loss layers.

When I execute the training command in terminal, however, this error is raised:

[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.2.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'

My Python Package Manager (pip) has version 3.2.0 of protobuf installed, but the system version is at 2.6.1 for a package called libprotoc. I am not sure how to specify that the pip protobuf version is the one I want to use for caffe.

On another computer which has version 3.3.0 of protobuf installed on pip and 2.6.1 for the system version, I was thrown the same error, except that it said the program required version 3.3.0 rather than version 3.2.0.

Best.


Solution

  • I ran into exactly the same issue today. The workaround that worked for me was to start the training from caffe's python interface as opposed to starting it directly from the shell. Example:

    import caffe
    
    weights = '../ilsvrc-nets/vgg16-fcn.caffemodel'
    caffe.set_device(0)
    caffe.set_mode_gpu()
    
    solver = caffe.SGDSolver('solver.prototxt')
    solver.net.copy_from(weights)
    
    for _ in range(25):
        solver.step(4000)
    

    Off course the above is just an example/very barebones, you'll have to handle running against the validation set yourself but the pycaffe interface is quite flexible and allows you to do all that. You can find more details on how to use that here:

    http://christopher5106.github.io/deep/learning/2015/09/04/Deep-learning-tutorial-on-Caffe-Technology.html