val-iisc / expresso

expresso
Other
44 stars 14 forks source link

GTK 2/3 conflict + proposed solution #13

Open Laurae2 opened 8 years ago

Laurae2 commented 8 years ago

Hello,

I wonder what can be done to solve the GTK dependency hell issue. 2 and 3 cannot be run at the same time in the same process. I cannot get it to work even on a clean machine (Ubuntu 14.04).

I checked by printing lines and It stops exactly at the following line (805) in main.py: app = QtGui.QApplication(sys.argv)

I can't uninstall GTK 2 because I need it, and I can't also uninstall GTK 3 because I also need it.

laurae-linux@Laurae-Linux:~/Downloads/expresso$ sh run_expresso.sh
/home/laurae-linux/Downloads/expresso ROOT
/home/laurae-linux/Downloads/caffe/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::vector<int, std::allocator<int> > already registered; second conversion method ignored.
  from ._caffe import \
/usr/local/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
/home/laurae-linux/Downloads/expresso
/home/laurae-linux/Downloads/expresso
/home/laurae-linux/Downloads/expresso

**(main.py:24084): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported**
Trace/breakpoint trap (core dumped)

Here is what happens when I force GTK 2 usage in main:

import gtk
laurae-linux@Laurae-Linux:~/Downloads/expresso$ sh run_expresso.sh
/home/laurae-linux/Downloads/expresso ROOT
/home/laurae-linux/Downloads/caffe/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::vector<int, std::allocator<int> > already registered; second conversion method ignored.
  from ._caffe import \
/home/laurae-linux/Downloads/expresso
/home/laurae-linux/Downloads/expresso
/home/laurae-linux/Downloads/expresso
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
  import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type 'PyGtkGenericCellRenderer' is smaller than the parent type's 'GtkCellRenderer' class size
  from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion 'node != NULL' failed
  from gtk import _gtk
Segmentation fault (core dumped)

Forcing GTK 3 makes GTK 2 still seen:

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
laurae-linux@Laurae-Linux:~/Downloads/expresso$ sh run_expresso.sh
/home/laurae-linux/Downloads/expresso ROOT
/home/laurae-linux/Downloads/caffe/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for std::vector<int, std::allocator<int> > already registered; second conversion method ignored.
  from ._caffe import \
/home/laurae-linux/Downloads/expresso
/home/laurae-linux/Downloads/expresso
/home/laurae-linux/Downloads/expresso

(main.py:30810): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap (core dumped)

Obviously these ideas are not supposed to work because the Qt are not imported from main.

So let's drop import gtk in the first line of the script. And Expresso runs.

SamVadidar commented 5 years ago

Hi, I am struggling with the same error using qt and opencv. I thought maybe opencv is installed from the source with_gtk+ enabled while qt is using gtk2. Thus, I am trying to install opencv with no gui and see if I can only used qt gui. The language of my code is c++. Do you think it will solve my problem? Do you have any idea how can I set only gtk2 as default for my application and force it to use only one version of gtk?