[PyQt] sip5 question / failed to register with the sip module
Phil Thompson
phil at riverbankcomputing.com
Fri Jan 3 10:40:40 GMT 2020
On 03/01/2020 00:39, michael h wrote:
> I'm attempting to upgrade a project so an extension module is built
> using
> sip5. The extension module wraps another Qt5 based library
> (poppler-qt5).
> This is on Windows 10 and I'm building 32-bit binaries.
>
> I installed PyQt5 v5.14.0 and sip v5.0.1 from pypi and created a
> pyproject.toml file for the extension module. I am using the .sip files
> from the PyQt5-5.14.0.tar.gz source files.
>
> When running `sip-build` I got the following error message:
> sip-build: Q_PID is undefined
>
> (I'm not using anything from qprocess.sip myself, so I just commented
> the
> line/method in the .sip file using that typedef and moved on, I just
> thought it was worth mentioning the possible bug, since these are the
> unmodified .sip files from the PyQt release.)
Don't use the .sip files from the source tarball. Instead install PyQt5
(either from source or from the wheel). This will install the .sip files
where sip5 expects to find them along with required configuration
information (that deals with the Q_PID issue). Have a look at the
site-packages/PyQt5/bindings directory.
> After that modification I was able to build the extension, but when I
> import the extension module I get an error:
>
> RuntimeError: the PyQt5.QtCore module failed to register with the sip
> module
>
> I guessed at this being related to PyQt5 having a private sip module,
> so I
> tried to use `PyQt5.sip` as the sip module name but I got the following
> error:
>
> sip-build: popplerqt5 must be part of a project when used with a shared
> 'sip' module
>
> I removed the check in sip's bindings.py to see if it would work. The
> module was built and now works but I'm concerned about the number of
> workarounds I'm employing here so I was hoping someone could comment on
> whether there's a more proper approach for me to use.
Until I look through the code I can't remember why that check is done.
Are you absolutely sure your module works properly? I'm happy to remove
the check if it is redundant.
Phil
More information about the PyQt
mailing list