[PyQt] Cannot launch exe built with pyqtdeploy (Python 3.5.1)

Marius Shekow marius.shekow at fit.fraunhofer.de
Mon Dec 14 09:59:15 GMT 2015


We're using pyqtdeploy to build a Python 3 / Qt 5.5.1 / PyQt5 program on 
Windows and Mac OS X. On Windows, this works fine using the MSVS 2013 
compiler, Python 3.4.3 and the Qt-MSVS2013-installer downloaded from the 
qt.io homepage. I compiled static versions of PyQt5 and SIP with MSVS2013.

However, with Python 3.5.1 it's no longer working.

I get the following error when trying to run the built exe binary:

Traceback (most recent call last):
   File "bootstrap.py", line 2454, in _install
   File "bootstrap.py", line 2400, in _setup
   File "bootstrap.py", line 2362, in _builtin_from_name
   File "bootstrap.py", line 1191, in _load_unlocked
   File "bootstrap.py", line 1161, in _load_backward_compatible
   File "bootstrap.py", line 550, in _requires_builtin_wrapper
   File "bootstrap.py", line 1294, in load_module
AttributeError: module '_imp' has no attribute 'init_builtin'
Fatal Python error: Py_Initialize: importlib install failed

Current thread 0x0000126c (most recent call first):

Any ideas?

Some details: I'm trying this with MSVS2015 community edition. I 
understand this is due to the Python team using this compiler for Python 
3.5.x, so I'd like to compile everything with this tool chain. I've 
compiled Qt 5.5.1 with it (dynamically linked version, i.e. the default 
version, following the official documentation). I compiled PyQt and SIP 
also with MSVS2015 (configured it with Python 3.5.1), both statically 
and dynamically linked versions. I can also run my program from the IDE 
with Python 3.5.1 without problems.

In pyqtdeploy I've adapted all Python 3.4-specific paths to be Python 
3.5-specific. I've *not* changed any checkboxes in the Standard library.

I've also noticed that the Makefile generated by qmake now wants to 
compile a debug version rather than the release version, which doesn't 
work (since I've not compiled Python 3.5 myself, I'm just using the 
binaries/libs as they come with the Python 3.5 installer, and there are 
no debug libs shipping with it). I have to manually hack the Makefile, 
e.g. change "first: debug" to "first: release". Compilation then does 
work, but the execution doesn't, like I have just described.

Marius Shekow
Mixed and Augmented Reality Solutions, Fraunhofer FIT
Tel.: +49 (0)2241 - 14-2184

More information about the PyQt mailing list