LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > MEPIS
User Name
Password
MEPIS This forum is for the discussion of MEPIS Linux.

Notices


Reply
  Search this Thread
Old 02-09-2015, 10:00 PM   #1
Penguin884
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Rep: Reputation: Disabled
Red face Python and GTK - Cannot Find Typelib


Hello. First post, so I apologize if I'm doing everything wrong. Maybe this is too general for a distro specific section, or maybe it's just a dumb question.

Anyway, I'm trying to get Python (3) working with GTK (3). Was following along with a tutorial, so I get to the basic hello world or whatever. Run it, get this error:

Code:
ERROR:root:Could not find any typelib for Gtk
Traceback (most recent call last):
  File "./hello2.py", line 2, in <module>
    from gi.repository import Gtk
ImportError: cannot import name Gtk
I shortened the program to just this, still get the error above:
Code:
#!/usr/bin/python
from gi.repository import Gtk
I'm on Anti-X 13.1. Have installed python (3 and 2, latest versions I think), gobject-instrospection, and python-gi. And some other things I thought sounded possibly related. If anything in particular needs to be (not) installed, call 'em out so I can check.

I found this which seems to point in the right direction, but lacks detail:

Quote:
Originally Posted by Michael Dussere
The problem is due to the compiled version of GTK3 that was not referenced in gobject-introspection.

It is simple to check the problem by listing the .typelib files in gobject-introspection


$ which g-ir-scanner
/Produits/publics/x86_64.Linux.RH6/gobject-introspection/1.40.0/bin/g-ir-scanner

$ ls /Produits/publics/x86_64.Linux.RH6/gobject-introspection/1.40.0/lib/girepository-1.0/
cairo-1.0.typelib fontconfig-2.0.typelib GIRepository-2.0.typelib GModule-2.0.typelib win32-1.0.typelib xlib-2.0.typelib
DBus-1.0.typelib freetype2-2.0.typelib GL-1.0.typelib GObject-2.0.typelib xfixes-4.0.typelib xrandr-1.3.typelib
DBusGLib-1.0.typelib Gio-2.0.typelib GLib-2.0.typelib libxml2-2.0.typelib xft-2.0.typelib

The problem should be solved by recompiling GTK (and its dependencies) with the configure option --enable-introspection=yes.
A. What does he mean by 'easy to check'? What am I checking for in that folder?
B. Any good guides I can use for recompiling stuff (GTK)?

Last edited by Penguin884; 02-10-2015 at 09:55 AM. Reason: Solved
 
Old 02-10-2015, 09:54 AM   #2
Penguin884
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Lightbulb

Yep, turns out this was a dumb question. All I needed was to install gir1.2-gtk-3.0. For the sake of posterity, I'll leave the command:

(sudo)
Code:
apt-get install gir1.2-gtk3.0
 
Old 10-19-2015, 05:47 PM   #3
Chris.Bristol
Member
 
Registered: Jul 2011
Distribution: Ubuntu 20.04
Posts: 235

Rep: Reputation: 14
I thought I had the same problem - but I haven't, I'd blank this post but I believe you aren't supposed to.

The suggested solution does not work, I get:

Quote:
chris@Asus:~/Documents/Linux/Debreate/GTK+$ sudo apt-get install gir1.2-gtk3.0
[sudo] password for chris:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gir1.2-gtk3.0
E: Couldn't find any package by regex 'gir1.2-gtk3.0'
chris@Asus:~/Documents/Linux/Debreate/GTK+$

Last edited by Chris.Bristol; 10-20-2015 at 11:49 AM.
 
Old 11-27-2015, 04:21 AM   #4
yajupadu
LQ Newbie
 
Registered: Nov 2015
Posts: 1

Rep: Reputation: Disabled
sudo apt-get install gir1.2-gtk-3.0

worked for me
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Python/Gtk3: dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) RockDoctor Programming 2 08-12-2014 07:37 AM
cannot find gtk-config on ubuntu9.04 after installing GTK Randyqiu Programming 2 11-17-2009 09:58 PM
python update - Unable to load GTK2 Python bindings: No module named gtk itpedersen Linux - Software 2 10-03-2008 03:44 AM
cant find gtk-config file or gtk-devel to install happychappy Linux - Software 2 02-16-2005 12:46 AM
WineX, python-gnome, and python-gtk DrD Fedora 0 08-03-2004 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > MEPIS

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration