libvirt-python fails to build with Python 3.10.0a2. Traceback (most recent call last): File "/builddir/build/BUILD/libvirt-python-6.9.0/sanitytest.py", line 5, in <module> import lxml.etree ImportError: /usr/lib64/python3.10/site-packages/lxml/etree.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send This seem to be related to https://github.com/cython/cython/issues/3876. It might be fixed with this patch https://github.com/cython/cython/pull/3877 that works for numpy. Upstream has decided to solve this differently, but until that happens, we are using this patch in our Copr (for other packages). For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01757137-libvirt-python/ For all our attempts to build libvirt-python with Python 3.10, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/libvirt-python/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/ Let us know here if you have any questions. Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
That stack trace shows the problem is in the lxml.etree module, not libvirt, so re-assigning.
Yes, sorry for the confusion. There was a mid air collision while I was updating the bugzilla. The above error was fixed in libxml, but libvirt-python rebuild leads to another error: libvirt-lxc-override.c:67:5: warning: ‘PyEval_ThreadsInitialized’ is deprecated [-Wdeprecated-declarations] 67 | LIBVIRT_BEGIN_ALLOW_THREADS; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/python3.10/Python.h:146, from libvirt-lxc-override.c:17: /usr/include/python3.10/ceval.h:121:36: note: declared here 121 | Py_DEPRECATED(3.9) PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); | ^~~~~~~~~~~~~~~~~~~~~~~~~ libvirt-lxc-override.c:69:5: warning: ‘PyEval_ThreadsInitialized’ is deprecated [-Wdeprecated-declarations] 69 | LIBVIRT_END_ALLOW_THREADS; | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/python3.10/Python.h:146, from libvirt-lxc-override.c:17: /usr/include/python3.10/ceval.h:121:36: note: declared here 121 | Py_DEPRECATED(3.9) PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); You can see full log here: https://download.copr.fedorainfracloud.org/results/@python/python3.10/fedora-rawhide-x86_64/01766717-libvirt-python/builder-live.log.gz https://docs.python.org/3.10/whatsnew/changelog.html#id48 bpo-39877: Deprecated PyEval_InitThreads() and PyEval_ThreadsInitialized(). Calling PyEval_InitThreads() now does nothing. Reassigning back to libvirt-python
Those messages, while important to fix, are merely warnings so don't cause the build to fail. The real problem shown in the logs is the test suite failure: running test /usr/bin/python3 sanitytest.py build/lib.linux-x86_64-3.1 /usr/share/libvirt/api/libvirt-api.xml Traceback (most recent call last): File "/builddir/build/BUILD/libvirt-python-6.9.0/sanitytest.py", line 11, in <module> import libvirt ModuleNotFoundError: No module named 'libvirt' error: command '/usr/bin/python3' failed with exit It looks like we're truncating the version number to 3.1 when passing the build directory.
From setup.py: plat_specifier = ".%s-%s" % (self.plat_name, sys.version[0:3]) I believe this is the cause. It evals to 3.1 on Python 3.10.
Fixes proposed upstream in https://gitlab.com/libvirt/libvirt-python/-/merge_requests/30
I've patched this in our copr to unblock testing the depended packages. Let me know if I should submit a PR. https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/1770405/
It'll get fixed in the next monthly rebase of libvirt around Dec 1st
That'll work nicely, thanks Daniel.