Search code examples
pythonanacondagtkpygtkconda-forge

Ubuntu - Anaconda 2020.02 - Namespace Gtk not available


This is on Ubuntu 16.04 LTS.

I've run into the same issue as this question:

ValueError: Namespace Gtk not available

I've done the following to set things up for gtk3

conda install -c conda-forge pygobject
sudo apt-get install libgtk-3-dev
sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0

However, the simple test program at:

https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html

fails, with the same error:

Python 3.7.7 (default, Mar 26 2020, 15:48:22) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version("Gtk", "3.0")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/me/anaconda3/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

Any other solutions that might be tried?

This was on a fresh install of Anaconda (Anaconda3-2020.02-Linux-x86_64.sh); did a conda update --all after installation. But am wondering what might be wrong.


Solution

  • There is a gtk3 package available on conda-forge:

    conda install -c conda-forge gtk3