RuntimeError: the PyQt5.QtCore module failed to register with the sip module
Edward A. Pier
epier at oceanit.com
Thu Jul 14 14:04:02 BST 2022
I have C++ code that depends on Qt5 that I wrap into Python using sip. I am porting code that worked under Ubuntu 20.04 (sip 4.19.21, PyQt5 5.14.1) to run under Ubuntu 22.04 (sip 6.5.1, PyQt5 5.15.6). Now when I import the resulting Python module I get the error in the subject line:
RuntimeError: the PyQt5.QtCore module failed to register with the sip module
I traced this to the generated file siplib.c in the sip_api_export_module function. This function tries to load required modules, of which PyQt5.QtCore is the first. It calls PyImport_ImportModule and then tries to find the module in a linked list kept in the moduleList variable. The problem is that on the first call to sip_api_export_module, moduleList=NULL, i.e. the list is empty, as it only gets updated at the bottom of sip_api_export_module.
So I'm a bit stumped how this could work, unless the first module for which sip_api_export_module is called does not have dependencies, or sip_api_export_module is called for those dependencies first. I've read through the pyproject.toml documentation, but I didn't see any way to make either of these things happen.
Let me know what additional information might help get to the bottom of this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220714/ad256619/attachment.htm>
More information about the PyQt
mailing list