When following the instructions 2. Getting Started — Python GTK+ 3 Tutorial 3.4 documentation


In [6]: import gi
   ...: gi.require_version('Gtk', '3.0')
   ...: from gi.repository import Gtk

it report errors:

~/anaconda3/lib/python3.7/site-packages/gi/__init__.py in require_version(namespace, version)
    128     available_versions = repository.enumerate_versions(namespace)
    129     if not available_versions:
--> 130         raise ValueError('Namespace %s not available' % namespace)
    132     if version not in available_versions:

ValueError: Namespace Gtk not available

Follow How do I Install GTK+ 3.0? - Ask Ubuntu and intstalled Gtk to ubuntu

sudo apt-get install libgtk-3-dev

However, it still report the same errors.

How could solve the problem?

  • You have installed another version of python3 and masked system python3. Execute which python3 to know which python3 you used. System python3, which contains gi and Gtk, is located in /usr/bin/python3. Jul 2, 2019 at 9:44
  • yes, after set /usr/bin/python3 as default it report the same error. @PingChuHung
    – AbstProcDo
    Jul 2, 2019 at 12:07
  • Please update the error message. And append the outputs of dpkg -l | grep libgtk3 and dpkg -l | grep libgtk-3. Jul 5, 2019 at 7:13

1 Answer 1


I had the same issue but solved it by just making a python virtual environment and then running the command you listed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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