[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] How to build pyqt sources to provide the same content than official wheel?
From:       BPL <spscener84 () gmail ! com>
Date:       2019-07-21 11:26:43
Message-ID: CAAfY3fYM2kCwZcfO6BTLyfWpScVy9rB3Zhk3YFfYUpbxLr3W+g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Just to let you know all the problems I've faced were mainly because I'd
compiled qt+ssl using vcpkg <https://github.com/microsoft/vcpkg>
include/lib directories and by doing so
I'd be forced to add vcpkg bin directory at runtime, otherwise the pyqt
dlls will have missing dependencies.

As a simple solution I've compiled qt with no ssl support (auto) and just
modified *qocspresponse.sip* generated by metasip, which it's
missing a code guard, :

%If (Qt_5_13_0 -)
%If (PyQt_SSL)

%ModuleCode
#include <qocspresponse.h>
%End
%End
%End


That way I've been able to use latest qt from github repo without waiting
weeks/months to be released \:O/

Phil, would it be possible to change qocspresponse.sip with this code guard
so you won't be forced to use qt with ssl feature or it's this a limitation
of metasip?

Thanks.

On Sat, Jul 20, 2019 at 6:38 PM BPL <spscener84@gmail.com> wrote:

> Phil,
>
> don't mind my previous mail, I think I've found the issue here... problem
> some Pyqt5 pyd not loading is because they were missing
> some external dlls such as libpng16.dll... right now I'm trying to figure
> out why, maybe the way I've compiled qt:
>
> configure.bat -prefix "d:/qt/5.13.0-394-g69ef6e8212" -opensource
> -confirm-license -nomake examples -nomake tests -opengl dynamic -ssl -L
> D:/software/vcpkg/installed/x86-windows/lib -I
> D:/software/vcpkg/installed/x86-windows/include -v
>
> wasn't a good idea afterall... I suspect by doing this I've been forced to
> add d:/software/vcpkg/installed/x86-windows/bin to path when importing
> PyQt as well so that libpng16.dll will be found... so probably the best
> way to link openssl is by downloading & compiling openssl in isolation (ie:
> https://www.openssl.org/source/)
> and not relying in vcpkg at all :/
>
> On Sat, Jul 20, 2019 at 5:54 PM BPL <spscener84@gmail.com> wrote:
>
>> Phil,
>>
>> Usually I don't have any of my available qt distributions in path, when
>> you said
>>
>> You don't copy your Qt installation, PyQt (when build from sources) will
>>> use it where it is.
>>
>>
>> I guess you meant PyQt (when built from sources) will use the Qt
>> installation from either path
>> or from the Qt folder in the target dir where PyQt has been installed. I
>> can see pyqt
>> __init__.py looks like this:
>>
>> def find_qt():
>>     import os
>>
>>     path = os.environ['PATH']
>>
>>     dll_dir = os.path.dirname(__file__) + '\\Qt\\bin'
>>     if os.path.isfile(dll_dir + '\\Qt5Core.dll'):
>>         path = dll_dir + ';' + path
>>         os.environ['PATH'] = path
>>     else:
>>         for dll_dir in path.split(';'):
>>             if os.path.isfile(dll_dir + '\\Qt5Core.dll'):
>>                 break
>>         else:
>>             raise ImportError("unable to find Qt5Core.dll on PATH")
>>
>>     try:
>>         os.add_dll_directory(dll_dir)
>>     except AttributeError:
>>         pass
>>
>>
>> find_qt()
>> del find_qt
>>
>>
>> As a workaround I've decided to create a junction pointing out
>> to the Qt distribution used to build pyqt from sources, ie:
>>
>> (py364_32) d:\virtual_envs\py364_32\Lib\site-packages\PyQt5>mklink /j Qt
>> d:\qt\5.13.0-394-g69ef6e8212
>> Junction created for Qt <<===>> d:\qt\5.13.0-394-g69ef6e8212
>>
>>
>> But for some reason when I do `from PyQt5.Qt import *` I'll just get this
>> content
>> <https://dl.dropboxusercontent.com/s/cj9rf8mbm023rwf/2019-07-20_17-49-10.txt> where
>> you can see there isn't any available
>> QApplication :(
>>
>> And when doing `from PyQt5.QtWidgets import *` I'll get:
>>
>>     from PyQt5.QtWidgets import *
>> ImportError: DLL load failed: The specified module could not be found.
>>
>> So I'm stuck at this point, could you advice?
>>
>> On Sat, Jul 20, 2019 at 4:34 PM BPL <spscener84@gmail.com> wrote:
>>
>>> Florian,
>>>
>>> Thanks to provide those wiki docs as well as the qt releasing mailing
>>> list, they're definitely
>>> helpful indeed to make proper planning.
>>>
>>> If I look in retrospective is funny though, that QTBUG-74492 is the
>>> first one I've ever been involved with,
>>> this bug was opened in 21.03.2019 and after few months passed nobody was
>>> working on it or they didn't
>>> know what the problem was. I decided to spend some days bisecting the
>>> bug and finding the root cause
>>> of the problem, thanks to that the author who introduced the bug in the
>>> first place could fix it properly in few days. In any case,
>>> finding the issue was really tricky and the fix ended up to be quite
>>> "trivial" one. The moral of the story here is,
>>> for something as trivial as this one you'll need to wait quite a lot of
>>> time to get
>>> a proper release... and that's assuming you're interested enough to help
>>> Qt team to narrow it down. The
>>> workload of Qt devs isn't small neither... which indicates there is room
>>> to optimize development in that company.
>>>
>>> Bug opened in 21.03.2019 and official release with the fix delivered in
>>> 15.08.2019... That's quite a lot
>>> of time to wait for...
>>>
>>> Anyway, at this point a global view of how things work in both Qt & pyqt
>>> has become +/- clear, which is great so you
>>> know what you can or can't expect.
>>>
>>> On Sat, Jul 20, 2019 at 3:10 PM Florian Bruhin <me@the-compiler.org>
>>> wrote:
>>>
>>>> On Sat, Jul 20, 2019 at 02:53:29PM +0200, BPL wrote:
>>>> > Anyway... I'll try again to see if I can make it work but hopefully a
>>>> new
>>>> > pyqt wheel with this annoying bug fix
>>>> > https://bugreports.qt.io/browse/QTBUG-74492
>>>> > will land soon at pypi, I've got some opengl tools in place where this
>>>> > glitch makes really annoying work with them, it's a really disturbing
>>>> bug :/
>>>>
>>>> As you can see in the bug report, the fix lands in Qt 5.12.5, 5.13.1
>>>> and 5.14.0.
>>>> Via the Qt wiki, you can see when those are planned to be released:
>>>>
>>>> https://wiki.qt.io/Qt_5.12_Release (5.12.5: 27.08.2019)
>>>> https://wiki.qt.io/Qt_5.13_Release (5.13.1: 15.08.2019)
>>>> https://wiki.qt.io/Qt_5.14_Release (5.14.0: 26.11.2019)
>>>>
>>>> After a new Qt is released, usually a couple of days afterwards, PyQt
>>>> gets
>>>> updated (might be a bit longer for new feature releases like 5.14 will
>>>> be).
>>>> So if you're okay with upgrading to Qt 5.13, you'll hopefully see an
>>>> updated
>>>> PyQt in a month or so.
>>>>
>>>> I'd also recommend subscribing to the Qt Releasing mailinglist - it's
>>>> quite
>>>> low-traffic, and you get announcement mails when Qt updates are
>>>> released, or
>>>> when there was a release team meeting (with the meeting minutes):
>>>>
>>>> https://lists.qt-project.org/listinfo/releasing
>>>>
>>>> Florian
>>>>
>>>> --
>>>> https://www.qutebrowser.org | me@the-compiler.org (Mail/XMPP)
>>>>    GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
>>>>          I love long mails! | https://email.is-not-s.ms/
>>>>
>>>

[Attachment #5 (text/html)]

<div dir="ltr">Just to let you know all the problems I&#39;ve faced were mainly \
because I&#39;d compiled qt+ssl using <a \
href="https://github.com/microsoft/vcpkg">vcpkg</a> include/lib directories and by \
doing so<div>I&#39;d be forced to add vcpkg bin directory at runtime, otherwise the \
pyqt dlls will have missing dependencies.</div><div><br></div><div>As a simple \
solution I&#39;ve compiled qt with no ssl support (auto) and just modified  \
<b>qocspresponse.sip</b>  generated by metasip, which it&#39;s<br></div><div>missing \
a code guard, :</div><div><br></div><blockquote style="margin:0 0 0 \
40px;border:none;padding:0px"><div>%If (Qt_5_13_0 -)</div><div>%If \
(PyQt_SSL)</div><div><br></div><div>%ModuleCode</div><div>#include \
&lt;qocspresponse.h&gt;</div><div>%End</div><div>%End</div><div>%End</div></blockquote><div><br></div><div>That \
way I&#39;ve been able to use latest qt from github repo without waiting weeks/months \
to be released \:O/</div><div><br></div><div>Phil, would it be possible to change \
qocspresponse.sip with this code guard so you won&#39;t be forced to use qt with ssl \
feature or it&#39;s this a limitation of \
metasip?<br></div><div><br></div><div>Thanks.</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 20, 2019 at 6:38 PM \
BPL &lt;<a href="mailto:spscener84@gmail.com">spscener84@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr">Phil,<div><br></div><div>don&#39;t mind my previous mail, I think I&#39;ve \
found the issue here... problem some Pyqt5 pyd not loading is because they were \
missing</div><div>some external dlls such as libpng16.dll... right now I&#39;m trying \
to figure out why, maybe the way I&#39;ve compiled \
qt:</div><div><br></div><div>configure.bat -prefix \
&quot;d:/qt/5.13.0-394-g69ef6e8212&quot; -opensource -confirm-license -nomake \
examples -nomake tests -opengl dynamic -ssl -L \
D:/software/vcpkg/installed/x86-windows/lib -I \
D:/software/vcpkg/installed/x86-windows/include -v  \
</div><div><br></div><div>wasn&#39;t a good idea afterall... I suspect by doing this \
I&#39;ve been forced to add d:/software/vcpkg/installed/x86-windows/bin to path when \
importing</div><div>PyQt as well so that libpng16.dll will be found... so probably \
the best way to link openssl is by downloading &amp; compiling openssl in isolation \
(ie:  <a href="https://www.openssl.org/source/" \
target="_blank">https://www.openssl.org/source/</a>)<br></div><div>and not relying in \
vcpkg at all :/</div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Sat, Jul 20, 2019 at 5:54 PM BPL &lt;<a \
href="mailto:spscener84@gmail.com" target="_blank">spscener84@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr">Phil,<div><br></div><div>Usually I don&#39;t have any of my available qt \
distributions in path, when you said</div><div><br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">You don&#39;t copy your Qt installation, PyQt \
(when build from sources) will  <br>use it where it is.    \
</blockquote><div><br></div><div>I guess you meant PyQt (when built from sources) \
will use the Qt installation from either path</div><div>or from the Qt folder in the \
target dir where PyQt has been installed. I can see pyqt  </div><div>__init__.py \
looks like this:</div><div><br></div><blockquote style="margin:0px 0px 0px \
40px;border:none;padding:0px"><div>def find_qt():</div><div>      import \
os</div><div><br></div><div>      path = \
os.environ[&#39;PATH&#39;]</div><div><br></div><div>      dll_dir = \
os.path.dirname(__file__) + &#39;\\Qt\\bin&#39;</div><div>      if \
os.path.isfile(dll_dir + &#39;\\Qt5Core.dll&#39;):</div><div>            path = \
dll_dir + &#39;;&#39; + path</div><div>            os.environ[&#39;PATH&#39;] = \
path</div><div>      else:</div><div>            for dll_dir in \
path.split(&#39;;&#39;):</div><div>                  if os.path.isfile(dll_dir + \
&#39;\\Qt5Core.dll&#39;):</div><div>                        break</div><div>          \
else:</div><div>                  raise ImportError(&quot;unable to find Qt5Core.dll \
on PATH&quot;)</div><div><br></div><div>      try:</div><div>            \
os.add_dll_directory(dll_dir)</div><div>      except AttributeError:</div><div>       \
pass</div><div><br></div><div><br></div><div>find_qt()</div><div>del \
find_qt</div></blockquote><div><br></div><div>As a workaround I&#39;ve decided to \
create a junction pointing out  </div><div>to the Qt distribution used to build pyqt \
from sources, ie:</div><div><br></div><blockquote style="margin:0px 0px 0px \
40px;border:none;padding:0px"><div>(py364_32) \
d:\virtual_envs\py364_32\Lib\site-packages\PyQt5&gt;mklink /j Qt \
d:\qt\5.13.0-394-g69ef6e8212</div><div>Junction created for Qt &lt;&lt;===&gt;&gt; \
d:\qt\5.13.0-394-g69ef6e8212</div></blockquote><div><br></div><div>But for some \
reason when I do `from PyQt5.Qt import *` I&#39;ll just get this <a \
href="https://dl.dropboxusercontent.com/s/cj9rf8mbm023rwf/2019-07-20_17-49-10.txt" \
target="_blank">content</a>  where you can see there isn&#39;t any \
available</div><div>QApplication :(</div><div><br></div><div>And when doing `from \
PyQt5.QtWidgets import *` I&#39;ll get:</div><div><br></div><blockquote \
style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>      from \
PyQt5.QtWidgets import *<br></div><div>ImportError: DLL load failed: The specified \
module could not be found.</div><div><br></div></blockquote>So I&#39;m stuck at this \
point, could you advice?</div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Sat, Jul 20, 2019 at 4:34 PM BPL &lt;<a \
href="mailto:spscener84@gmail.com" target="_blank">spscener84@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr">Florian,<div><br></div><div>Thanks to provide those wiki docs as well as \
the qt releasing mailing list, they&#39;re definitely</div><div>helpful indeed to \
make proper planning.</div><div><br></div><div>If I look in retrospective is funny \
though, that QTBUG-74492 is the first one I&#39;ve ever been involved with,  \
</div><div>this bug was opened in 21.03.2019 and after few months passed nobody was \
working on it or they didn&#39;t</div><div>know what the problem was. I decided to \
spend some days bisecting the bug and finding the root cause  </div><div>of the \
problem, thanks to that the author who introduced the bug in the first place could \
fix it properly in few days. In any case,  </div><div>finding the issue was really \
tricky and the fix ended up to be quite &quot;trivial&quot; one. The moral of the \
story here is,  </div><div>for something as trivial as this one you&#39;ll need to \
wait quite a lot of time to get</div><div>a proper release... and that&#39;s assuming \
you&#39;re interested enough to help Qt team to narrow it down. The  \
</div><div>workload of Qt devs isn&#39;t small neither... which indicates there is \
room to optimize development in that company.</div><div><br></div><div>Bug opened in \
21.03.2019 and official release with the fix delivered in 15.08.2019... That&#39;s \
quite a lot<br></div><div>of time to wait for...</div><div><br></div><div>Anyway, at \
this point a global view of how things work in both Qt &amp; pyqt has become +/- \
clear, which is great so you</div><div>know what you can or can&#39;t \
expect.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On \
Sat, Jul 20, 2019 at 3:10 PM Florian Bruhin &lt;<a href="mailto:me@the-compiler.org" \
target="_blank">me@the-compiler.org</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">On Sat, Jul 20, 2019 at 02:53:29PM +0200, BPL \
wrote:<br> &gt; Anyway... I&#39;ll try again to see if I can make it work but \
hopefully a new<br> &gt; pyqt wheel with this annoying bug fix<br>
&gt; <a href="https://bugreports.qt.io/browse/QTBUG-74492" rel="noreferrer" \
target="_blank">https://bugreports.qt.io/browse/QTBUG-74492</a><br> &gt; will land \
soon at pypi, I&#39;ve got some opengl tools in place where this<br> &gt; glitch \
makes really annoying work with them, it&#39;s a really disturbing bug :/<br> <br>
As you can see in the bug report, the fix lands in Qt 5.12.5, 5.13.1 and 5.14.0.<br>
Via the Qt wiki, you can see when those are planned to be released:<br>
<br>
<a href="https://wiki.qt.io/Qt_5.12_Release" rel="noreferrer" \
target="_blank">https://wiki.qt.io/Qt_5.12_Release</a> (5.12.5: 27.08.2019)<br> <a \
href="https://wiki.qt.io/Qt_5.13_Release" rel="noreferrer" \
target="_blank">https://wiki.qt.io/Qt_5.13_Release</a> (5.13.1: 15.08.2019)<br> <a \
href="https://wiki.qt.io/Qt_5.14_Release" rel="noreferrer" \
target="_blank">https://wiki.qt.io/Qt_5.14_Release</a> (5.14.0: 26.11.2019)<br> <br>
After a new Qt is released, usually a couple of days afterwards, PyQt gets<br>
updated (might be a bit longer for new feature releases like 5.14 will be).<br>
So if you&#39;re okay with upgrading to Qt 5.13, you&#39;ll hopefully see an \
updated<br> PyQt in a month or so.<br>
<br>
I&#39;d also recommend subscribing to the Qt Releasing mailinglist - it&#39;s \
quite<br> low-traffic, and you get announcement mails when Qt updates are released, \
or<br> when there was a release team meeting (with the meeting minutes):<br>
<br>
<a href="https://lists.qt-project.org/listinfo/releasing" rel="noreferrer" \
target="_blank">https://lists.qt-project.org/listinfo/releasing</a><br> <br>
Florian<br>
<br>
-- <br>
<a href="https://www.qutebrowser.org" rel="noreferrer" \
target="_blank">https://www.qutebrowser.org</a> | <a \
href="mailto:me@the-compiler.org" target="_blank">me@the-compiler.org</a> \
                (Mail/XMPP)<br>
     GPG: 916E B0C8 FD55 A072 | <a href="https://the-compiler.org/pubkey.asc" \
                rel="noreferrer" \
                target="_blank">https://the-compiler.org/pubkey.asc</a><br>
              I love long mails! | <a href="https://email.is-not-s.ms/" \
rel="noreferrer" target="_blank">https://email.is-not-s.ms/</a><br> \
</blockquote></div> </blockquote></div>
</blockquote></div>
</blockquote></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic