<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
RuntimeError: the PyQt5.QtCore module failed to register with the sip module</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Let me know what additional information might help get to the bottom of this.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</body>
</html>