How to get the proper version?

Florian Bruhin me at the-compiler.org
Thu Mar 4 10:08:44 GMT 2021


On Thu, Mar 04, 2021 at 09:18:47AM +0000, Phil Thompson wrote:
> On 03/03/2021 14:55, ullix wrote:
> > After my trouble installing PyQt5-5.15.3 I decided to log all package
> > version numbers.
> > 
> > Pip tells me I have these:
> > 
> >    PyQt5              5.15.3
> >    PyQt5-Qt         5.15.2
> >    PyQt5-sip        12.8.1
> > 
> > But trying this in Python with the variable names in the middle
> > column, I get:
> > 
> > PyQt:         PYQT_VERSION_STR   -->  5.15.3
> > PyQt-Qt:    QT_VERSION_STR       -->  5.15.2
> > PyQt-sip:    SIP_VERSION_STR      -->  5.4.0
> > 
> > This is obtained following Pythons official guidance:
> > 
> > https://wiki.python.org/moin/PyQt/Getting%20the%20version%20numbers%20of%20Qt%2C%20SIP%20and%20PyQt
> 
> That's not "official", this is...
> 
> https://www.riverbankcomputing.com/static/Docs/PyQt5/api/sip/sip-module.html#SIP_VERSION
> 
> > But the sip version is obviously wrong. What kind of sip did I
> > actually get, and how do I get the correct one?
> 
> You are confusing the SIP code generator (SIP_VERSION_STR: v5.4.0) and
> PyQt5's sip module (v12.8.1). The module's version number corresponds to the
> ABI that it implements. At the moment this isn't available from Python.
> 
> Phil

Note you can ask importlib_metadata about the package version:

    >>> import importlib_metadata
    >>> importlib_metadata.version('PyQt5-sip')
    '12.8.1'

Florian

-- 
            me at the-compiler.org | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210304/833cdab5/attachment.sig>


More information about the PyQt mailing list