Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported #21

Open
tashianasir opened this issue Nov 25, 2017 · 19 comments

Comments

@tashianasir
Copy link

Hi,
I am using fastfusion on Ubuntu 16.04, and when i run fastfusion after building, I get the following error:

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

I cannot delete either of the two because both are needed by basic OS applications.
Is fastfusion direcly importing GTK libraries, or could it be OpenCV importing symbols from both GTK versions?
Any hints how I can get pass it will be greatly appreciated.

Thanks.

@tashianasir
Copy link
Author

tashianasir commented Nov 26, 2017

Please note that "ldd" shows only gtk3, I am unable to understand how gtk2 symbols are being used by the program.

`~/fastfusion $ ldd -d bin/onlinefusion | grep gtk

libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007f51ee529000)

`

@mayankamedhe
Copy link

Hi,
I am facing the same problem. Does anyone know how to solve it? @tashianasir?

@dbadrian
Copy link

dbadrian commented Sep 3, 2018

(I'm on Ubuntu 18.04)

I fixed it by manually compiling OpenCV and setting it to use GTK2.0. Make sure to enable
WITH_GTK_2_X when configuring via CMake.

Afterwards you might face a new bug, if you use the most recent OpenCV version, about ::type not being a member or something (sry, dont have my logs anymore).

You need to change all:
cv::Datatype< DT >::type to cv::traits::Type::value

Furthermore, in src/auxiliary/ocv_tools.cpp I needed to comment out a part of the code which is referencing a now out-dated datatype. Specifically this part:

#include <auxiliary/ocv_tools.h>
[...]

    // if(m.type() == cv::traits::Type<uint>::value)
    // {
    //     return "uint";
    // }

[...]

For me this doesn't break anything. If it does for you, either recompile OpenCV with deprecated types enabled in traits, or change to a new, equivalent type.

EDIT: For example, see https://github.com/ros-perception/image_pipeline/pull/302/files which performs a comparable fix in a DIFFERENT (aka unrelated) project.

@phamvandan
Copy link

phamvandan commented Nov 26, 2019

HELLO GUYS, After many months work with this error, I have just passed this by append this two lines in the head of the main python file. It will specify only version, which you want when your environment have many version of GTK. Good lucks !
import gi
gi.require_version('Gtk', '2.0')

@imohammadhossein
Copy link

gi

no module named gi!

@devkapilbansal
Copy link

@phamvandan ValueError: Namespace Gtk is already loaded with version 3.0 when using gi.require_version('Gtk','2.0')

@phamvandan
Copy link

@imohamadhoseins pip install gi

@phamvandan
Copy link

@devkapilbansal Oh, i don't know this error

@devkapilbansal
Copy link

@devkapilbansal Oh, i don't know this error

@phamvandan I found it. It was because I was using matplotlib and opencv at a same time and probably both uses different Gtk versions

@phamvandan
Copy link

@devkapilbansal , yeah, I see.

@Achilles107
Copy link

HELLO GUYS, After many months work with this error, I have just passed this by append this two lines in the head of the main python file. It will specify only version, which you want when your environment have many version of GTK. Good lucks !
import gi
gi.require_version('Gtk', '2.0')

Thanks for the fix. Really helped

@aaaaangel
Copy link

HELLO GUYS, After many months work with this error, I have just passed this by append this two lines in the head of the main python file. It will specify only version, which you want when your environment have many version of GTK. Good lucks !
import gi
gi.require_version('Gtk', '2.0')

Thanks for the fix. Really helped

@Achilles107 where is the main python file in this repository?

@Vigneshpadoor
Copy link

@devkapilbansal how did you solve the problem? were you able to use both together?

@devkapilbansal
Copy link

@Vigneshpadoor I use opencv only there removing matplotlib and doing the changes in separate files

@u4david
Copy link

u4david commented Jan 27, 2021

import gi
gi.require_version('Gtk', '2.0')

Could you elaborate how to implement the fix above pls?
Thank you

Fix related to this error running eviacam:
(eviacam:22012): Gtk-ERROR **: 15:04:20.718: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap (core dumped)

@alao-emmanuel
Copy link

import gi
gi.require_version('Gtk', '2.0')

Could you elaborate how to implement the fix above pls?
Thank you

Fix related to this error running eviacam:
(eviacam:22012): Gtk-ERROR **: 15:04:20.718: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap (core dumped)

Just add it to the "TOP" of your python script or avoiding using both openCV and matplotlib

@cjchng
Copy link

cjchng commented Feb 21, 2022

In testing gtkmm3.x with openCV used, it will conflict with the default GTK+ 2.x installed. To this issue, I rebuild OpenCV by unchecking the option of GTK+ 2.x, then this error message disappears.

discoimp referenced this issue in discoimp/orb_slam3_ros_wrapper Nov 9, 2022
EuRoC dataset not working (yet)
@MagnusErler
Copy link

HELLO GUYS, After many months work with this error, I have just passed this by append this two lines in the head of the main python file. It will specify only version, which you want when your environment have many version of GTK. Good lucks ! import gi gi.require_version('Gtk', '2.0')

How can this be implemented in c++?

@phamvandan
Copy link

phamvandan commented Nov 16, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests