Caffe with python layers problem, GTK 2.x symbols detected

Hello everyone.

I had worked with caffe in my laptop since 4 months ago, in my implementation I use a neuronal network with python layers implemented on caffe. Now I’m trying to implement my network in my Jetson TX1:

  • Hardware: Jetson TX1
  • System: Ubuntu 16.04
  • Jetpack: LT4T v2.3
  • After of install Jetpack LT4T, I followed this tutorial to install caffe on the Jetson:

    http://www.jetsonhacks.com/2015/12/07/caffe-deep-learning-framework-nvidia-jetson-tx1/

    And caffe works fine with the networks with c++ pure code, but when I try to train my own neuronal network:

    ./tools/caffe train -solver ./path/to/solver.prototxt
    

    I find the following error message:

    (mod python:2729): Gtk-ERROR **: GTK 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported Trace/breakpoint trap
    

    Caffe runs perfectly in my laptop without any problems. So I can discard problems with the code.

    I tried with the newest version of caffe and the version that I have in my laptop, but even though it compiles correctly the error continues. The same issue occurs when I try to import caffe and openCV from python, like this simple code;

    import cv2
    import numpy as np
    import caffe
    import cv2
    
    img =cv2.imread('share.png',0)
    cv2.namedWindow('image')
    cv2.imshow('image',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    

    Searching in the web, I found that it can occurs because some libraries works with different versions of GTK, but when I check the dependences I received the following information:

    $ ldd /usr/lib/python2.7/dist-packages/cv2.so | grep -i gtk	
    libgtk-x11-2.0.so.0 => /usr/lib/aarch64-linux-gnu/libgtk-x11-2.0.so.0 (0x0000007f9c323000)
    
    $ldd /home/ubuntu/caffe/lib/_caffe.so | grep -i gtk	
    libgtk-x11-2.0.so.0 => /usr/lib/aarch64-linux-gnu/libgtk-x11-2.0.so.0 (0x0000007f87873000)
    

    So, both works with the version 2.0… When I use only the python interface with caffe the network works fine (for testing), so I don’t know what is the problem or how I can solve it. Anyone knows how I can solve this problem?

    Thanks a lot for your answers!, I really appreciate any information about it, since I’ve been trying to solve the problem for several days.

    Thanks a lot for your answers!

    Hi Edgar, might you be able to look at my post from the following: https://github.com/dusty-nv/jetson-inference/issues/9

    There was some slight update to installation procedure after JetPack 2.3 update, which the Jethacks author posted the question about. Let me know if you are still experiencing the issue, thanks.

    Hi,

    We have tried MNIST training sample with BVLC caffe. It works fine on tx1 under JetPack-2.3.1.

    Could you tried it first?

    Source: https://github.com/BVLC/caffe

    cd $CAFFE_ROOT
    ./data/mnist/get_mnist.sh
    ./examples/mnist/create_mnist.sh
    ./examples/mnist/train_lenet.sh | tee res.out
    

    Thanks both for your answers! After searching on the web I finally found the solution in this post:

    https://github.com/yosinski/deep-visualization-toolbox/issues/10

    The problem was a line on python libraries that uses a gtk3 extension:

  • File: matplotlibrc in line 38 (backend configuration)
  • # You can also deploy your own backend outside of matplotlib by
    # referring to the module name (which must be in the PYTHONPATH) as
    # 'module://my_backend'.
    backend      : gtk3agg
    

    In this file, I replaced the backend “gtk3agg” to “TkAgg”:

    # You can also deploy your own backend outside of matplotlib by
    # referring to the module name (which must be in the PYTHONPATH) as
    # 'module://my_backend'.
    backend      : TkAgg
    

    And the problem was finally solved!.