[PyQt] Can't use static PyQ5 build during development on Mac OS X

Phil Thompson phil at riverbankcomputing.com
Wed Nov 11 16:43:46 GMT 2015


On 11 Nov 2015, at 3:02 p.m., Marius Shekow <marius.shekow at fit.fraunhofer.de> wrote:
> 
> Am Mittwoch, 11. November 2015 12:59 CET, Phil Thompson <phil at riverbankcomputing.com> schrieb: 
> 
>> On 10 Nov 2015, at 4:07 p.m., Marius Shekow <marius.shekow at fit.fraunhofer.de> wrote:
>>> 
>>> Hi,
>>> 
>>> my goal is to distribute a redistributable application on Mac OS X, not making any assumptions about what Python, Qt, PyQt, ... the user has installed. I.e. my goal is to produce a self-contained build.
>>> 
>>> For this I want to use the existing/unmodified (dynamically linked) Python 3.4 and Qt 5.5.1 distributions (because building them myself is hard), and statically compile the other dependencies, such as SIP, PyQt, sqlite3, etc.
>>> 
>>> I'm using Mac OS X El Capitan. I've downloaded Python 3.4.3 from the official website and installed it. I've downloaded SIP from the RiverSide homepage and compiled it statically (with python3 configure.py --static + make + sudo make install). I.e. I'm using the python3 binary (for configuration) that is installed from the official Python 3.4.3 installer.
>>> 
>>> I've downloaded and installed Qt 5.5.1 from the official Qt homepage (the 32/64-bit Intel distribution). This installs it to ~/Qt5.5.1
>>> 
>>> I've then downloaded the PyQt5 sources and also built them statically (python3 configure.py --static --qmake ~/Qt5.5.1/5.5/clang_64/bin/qmake)
>>> I've also done "sudo make install".
>> 
>> Static libraries have to be linked against application code to create an executable. What are you linking against?
> I didn't even get to linking anything. All I wanted to do is to execute my PyQt application on the development machine itself (like a sanity check) before going to the next step: compiling a redistributable binary with pyqtdeploy.

There is no next step. You can only use a static PyQt in a compiled binary.

>>> The issue is that I can't really develop Python code this way. My IDE (PyCharm) claims that there is nothing in the PyQt5 package in site-packages. The directory is there, in /LIbrary/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyQt5. It contains an __init__.py, a bunch of .a library files and the uic directory with lots of other stuff". But references such as PyQt5.WtWidgets can't be resolved.
>>> 
>>> I'd really like to be able to code in Python on MacOS X with that static version. Is that possible?
>> 
>> If you plan to use the standard Qt and Python builds then what do you expect to gain from a static build of PyQt?
> Since I was to make working redistributable applications using pyqtdeploy ONLY when having PyQt compiled statically, this was the reason why I compiled it statically. I'm beginning to think that in order to be able to run my PyQt application (On the development machine) AND to be able to make a build using pyqtdeploy, I need to built PyQt5 twice, the statically AND dynamically linked version.

That's what most people would do.

Phil


More information about the PyQt mailing list