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

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

Recently, I have prepared a new environment for Xavier NX, and when I tried to execute the program I used in the past, I got an error like this, so I dealt with it. I usually solve these errors in a straightforward manner, but sometimes I want to solve them in a lump (also as a memo for those who encounter similar errors).

The cause seems to be the simultaneous use of GTX + 2 and 3 environment-dependent libraries. Now we need to find out which libraries are in conflict.

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

According to it, there is a possibility of conflict between matplotlibc and opencv. Try running the following code.

import cv2
import matplotlib.pyplot as plt

cv2.namedWindow("test")

bingo. I was able to confirm the same error as before.

image.png

I will specify the version of GTX to be used by editing the frame setting file of matplotlib. The files to be edited by matplotlib can be found by executing the following program.

python3 

import matplotlib

print (matplotlib.matplotlib_fname())#/usr/bin/python3/~~(abridgement)Is output

Uncomment the 40th line of the file and specify tkAgg. image.png

Now run the program used for verification again. Then, the following error occurs.

image.png

Apparently, the part I tried to solve this time was able to be solved safely. All you have to do is resolve this error. Install the library with the following code.

sudo apt-get install tk-dev

When I ran it again, I got a different error.

image.png

This time install the following

sudo apt-get install libcanberra-gtk-module

When I ran the verification program, I was able to run it without any problems. I was able to confirm that the program works without any problems.

Finally

I thought it would be nice to be able to look back on the procedure by summarizing the process of solving the error in an article.

Recommended Posts

Gtk-ERROR **: 04: 28: 17.451: GTK + 2.x symbols detected. Using GTK + 2.x and GTK + 3 in the same process is not supported error
When "ERROR: HTTP is not supported." Is displayed in mpsyt
OS X GPU is now supported in Tensorflow
Pipfile is not created in the current directory
About the difference between "==" and "is" in python
Investigate the cause when an error is thrown when python3.8 is not found when using lambda-uploader with python3.8
How to find out which process is using the localhost port and stop it