In Ubuntu 20.04...
Python 3.8, 3.9 and 3.10 built from source without errors or make test failures.
pip install PyGObject done in each respective venv.
With Python 3.8:
$ python
Python 3.8.12 (default, Mar 3 2022, 04:28:02)
[GCC 9.3.0] on linux
>>> import gi
>>> gi.require_version('AyatanaAppIndicator3', '0.1')
>>> from gi.repository import AyatanaAppIndicator3
>>> AyatanaAppIndicator3
<IntrospectionModule 'AyatanaAppIndicator3' from '/usr/lib/x86_64-linux-gnu/girepository-1.0/AyatanaAppIndicator3-0.1.typelib'>
>>>
>>> gi.require_version('AppIndicator3', '0.1')
>>> from gi.repository import AppIndicator3
>>> AppIndicator3
<IntrospectionModule 'AppIndicator3' from '/usr/lib/girepository-1.0/AppIndicator3-0.1.typelib'>
>>>
With Python 3.10 (same in Python 3.9):
$ python
Python 3.10.2 (main, Mar 3 2022, 03:40:42) [GCC 9.3.0] on linux
>>> import gi
>>> gi.require_version('AyatanaAppIndicator3', '0.1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/venv10/lib/python3.10/site-packages/gi/__init__.py", line 126, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AyatanaAppIndicator3 not available
>>> from gi.repository import AyatanaAppIndicator3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/venv10/lib/python3.10/site-packages/gi/importer.py", line 131, in load_module
raise ImportError('cannot import name %s, '
ImportError: cannot import name AyatanaAppIndicator3, introspection typelib not found
>>>
>>> gi.require_version('AppIndicator3', '0.1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/venv10/lib/python3.10/site-packages/gi/__init__.py", line 126, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AppIndicator3 not available
>>> from gi.repository import AppIndicator3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/venv10/lib/python3.10/site-packages/gi/importer.py", line 131, in load_module
raise ImportError('cannot import name %s, '
ImportError: cannot import name AppIndicator3, introspection typelib not found
>>>
What changed after Python 3.8 to cause this? How can I get this to work in Python 3.9 and 3.10?