Bug 2412451 - [virt-xml] fails with python exception
Summary: [virt-xml] fails with python exception
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL: https://artifacts.dev.testing-farm.io...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-11-05 09:57 UTC by Jelle van der Waa
Modified: 2025-12-03 20:51 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jelle van der Waa 2025-11-05 09:57:15 UTC
virt-xml crashes with a Python exception as gobject-introspection is no longer pulled in via python3-gobject-base. The question is if libosinfo should take the dependency (or change something) or the virt-install package should depend on it.

https://src.fedoraproject.org/rpms/pygobject3/c/6a4422642c746e124fc6b0bcecd40b74e4217510?branch=rawhide

Reproducible: Always

Steps to Reproduce:
1. virt-xml

Actual Results:
[root@ip-172-31-27-123 ~]# /usr/sbin/virt-xml
Traceback (most recent call last):
  File "/usr/lib64/python3.14/site-packages/gi/importer.py", line 137, in create_module
    introspection_module = get_introspection_module(namespace)
  File "/usr/lib64/python3.14/site-packages/gi/module.py", line 244, in get_introspection_module
    module = IntrospectionModule(namespace, version)
  File "/usr/lib64/python3.14/site-packages/gi/module.py", line 104, in __init__
    repository.require(namespace, version)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
gi.RepositoryError: Typelib file for namespace 'libxml2', version '2.0' not found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/sbin/virt-xml", line 5, in <module>
    from virtinst import virtxml
  File "/usr/share/virt-manager/virtinst/__init__.py", line 49, in <module>
    from virtinst.osdict import OSDB
  File "/usr/share/virt-manager/virtinst/osdict.py", line 13, in <module>
    from gi.repository import Libosinfo
  File "/usr/lib64/python3.14/site-packages/gi/importer.py", line 139, in create_module
    raise ImportError(e) from e
ImportError: Typelib file for namespace 'libxml2', version '2.0' not found

Expected Results:
No exception :)

Additional Information:
This only happened in our testing farm CI as that now lacks gobject-introspection as a package while our VM test images still have it via:

[root@fedora-rawhide-127-0-0-2-2201 ~]# rpm -q --whatrequires gobject-introspection
PackageKit-glib-1.3.1-6.fc44.x86_64

Comment 1 Cole Robinson 2025-11-06 12:31:29 UTC
@ngompa13 I see you dropped the `Requires: gobject-introspection` from python3-gobject.

Can you advise, what's the expectation here? Should libraries that provide gobject-introspection bindings pull it in, or should applications that use those bindings add the dep?

Maybe we should avoid this for f43 since this could trickle out dependency bugs

Comment 2 Neal Gompa 2025-12-03 13:50:28 UTC
(In reply to Cole Robinson from comment #1)
> @ngompa13 I see you dropped the `Requires: gobject-introspection`
> from python3-gobject.
> 
> Can you advise, what's the expectation here? Should libraries that provide
> gobject-introspection bindings pull it in, or should applications that use
> those bindings add the dep?
> 
> Maybe we should avoid this for f43 since this could trickle out dependency
> bugs

gobject-introspection was replaced with a glib2-internal implementation in v2.80, so applications and libraries need to switch to that. pygobject switched in 3.52 to this, so you need to migrate as well.

Migration documentation is provided here: https://docs.gtk.org/girepository/migrating-gi.html

Comment 3 Daniel Berrangé 2025-12-03 16:45:38 UTC
(In reply to Neal Gompa from comment #2)
> (In reply to Cole Robinson from comment #1)
> > @ngompa13 I see you dropped the `Requires: gobject-introspection`
> > from python3-gobject.
> > 
> > Can you advise, what's the expectation here? Should libraries that provide
> > gobject-introspection bindings pull it in, or should applications that use
> > those bindings add the dep?
> > 
> > Maybe we should avoid this for f43 since this could trickle out dependency
> > bugs
> 
> gobject-introspection was replaced with a glib2-internal implementation in
> v2.80, so applications and libraries need to switch to that. pygobject
> switched in 3.52 to this, so you need to migrate as well.
> 
> Migration documentation is provided here:
> https://docs.gtk.org/girepository/migrating-gi.html

That's talking about the C api, but apps using pygobject aren't directly exposed to that, so it doesn't seem like code changes should be needed. AFAICT all that's required is to add the missing "Requires: gobject-introspection" dep to virt-xml which should always have been present, as we shouldn't rely on indirect deps for things we directly need.

Comment 4 Pavel Hrdina 2025-12-03 18:25:56 UTC
I don't see how this is virt-xml issue.

From the original error message we try to import libosinfo using `from gi.repository import Libosinfo`.

If I try this in fedora rawhide/43 container where I install only python3-gobject and libosinfo and run the following in python:

    import gi
    from gi.repository import Libosinfo

I'll get the same error.

For some reason `gobject-introspection` provides `/usr/lib64/girepository-1.0/libxml2-2.0.typelib` and without this file present importing libosinfo fails.

Based on all of that `gobject-introspection` needs to be added to libosinfo package as dependency.

Comment 5 Neal Gompa 2025-12-03 20:51:27 UTC
Sigh. We really need a typelib dependency generator like every other RPM distro... :(


Note You need to log in before you can comment on or make changes to this bug.