Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was trying to access Settings in Update Manager to setup automatic updates. But the Settings Dialog does not pop up. Cannot Access Software Sources from the Ubuntu Software Center>Edit>Software Sources... either. When I try to run software sources from the terminal I get the following error.

$ sudo software-properties-gtk
Traceback (most recent call last):
  File "/usr/bin/software-properties-gtk", line 26, in <module>
    gi.require_version('Gtk', '2.0')
  File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 46, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

I understand that the package is looking for GTK namespace and requires Gtk version 2.0 Trying to check what version of GTK is installed, I run the following and get

$ apt-cache showpkg libgtk2.0-0 | more
Package: libgtk2.0-0
Versions: 
2.24.4-0ubuntu2 (/var/lib/apt/lists/Ubuntu%2011.04%20%5fNatty%20Narwhal%5f%20-%2
0Release%20i386%20(20110426)_dists_natty_main_binary-i386_Packages) (/var/lib/ap
t/lists/us.archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages) (/va
r/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/Ubuntu%2011.04%20%5fNatty%20Narwhal%5f
%20-%20Release%20i386%20(20110426)_dists_natty_main_binary-i386_Packages
                  MD5: 3ed10be69b676a812afff2c7fdaa4017

How do I get software sources to run?

Update:
Found a related question here.I have python2.5 installed, but haven't set up a symbolic link to it, and the above log mentions python2.7

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted
+50

I had the same problem and finally solved it! Just for the record, reinstalling the packages as stated above did not help. This is what I did.

According to the pygi docs, if you type

python -c 'from gi.repository import Gtk; print Gtk'

you should get

<gi.module.DynamicModule 'Gtk' from '/usr/lib/girepository-1.0/Gtk-3.0.typelib'>

(Gtk-2.0 depending on which version you have installed. I have Gtk-2.0.)

This gave me the clue. The Gtk typelib was in fact there but I suspected there may be another girepository-1.0 directory in my filesystem that was taking precedence. Using the locate command I found it in /usr/local/lib along with several libgirepository-1.0* libs. This directory did not contain the Gtk typelib. So I simply removed it along with the libraries and the problem is now solved.

share|improve this answer
    
I get ERROR:root:Could not find any typelib for Gtk Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name Gtk –  abel Jul 24 '11 at 17:02
1  
That means that the Python module trying to load the Gtk module cannot find it in the current girepository-1.0 directory, which assuming you installed the packages recommended by jnv, is apparently not in /usr/lib/ as it should be. Use the locate command as I explained before. Prior to using it enter sudo updatedb. –  Marduk Jul 25 '11 at 4:07
    
@Markud locate girepository-1.0 gives a list of locations pastie.org/2267942 –  abel Jul 25 '11 at 11:47
1  
Well, the Gtk typelib is there. I recommend you delete the libgirepository-1.0.* libraries in /usr/local/lib. –  Marduk Jul 25 '11 at 14:22
1  
Those libraries were present both in /usr/lib and /usr/local/lib. The ones in the latter location were taking precedence but the typelibs are in /usr/lib. Glad it works now. –  Marduk Aug 9 '11 at 4:27
show 1 more comment

Since software-properties is a Python application, it actually depends on package gir1.2-gtk-2.0. If you don't have this package installed, you have broken dependencies. Check it out using Synaptic.

Otherwise reinstallation of the affected packages may help:

sudo apt-get install --reinstall gir1.2-gtk-2.0 python-software-properties software-properties-gtk
share|improve this answer
    
I still get the same error! –  abel Jul 5 '11 at 18:52
add comment

ame as the above solution except I made a soft link in the /usr/local directory pointing to /usr/lib/girepository-1.0. I also renamed the old directory.

ls -l

drwxr-xr-x 2 root root 4,0K loka 14 14:08 girepository-1.0_old

lrwxrwxrwx 1 root root 25 loka 14 14:10 girepository-1.0 -> /usr/lib/girepository-1.0

It wouldn't work otherwise.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.