question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PyInstaller cannot find QtCompat.loadUi

See original GitHub issue

A regular print(QtCompat) will give you this:

['QFileDialog', 'QHeaderView', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_cli', '_convert', 'getCppPointer', 'loadUi', 'load_ui', 'qInstallMessageHandler', 'setSectionResizeMode', 'translate', 'wrapInstance']

But if using PyInstaller to build/freeze an application out of your python script (such as an .exe), the same command results in the following (where loadUi and load_ui are missing):

['QFileDialog', 'QHeaderView', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_cli', '_convert', 'getCppPointer', 'qInstallMessageHandler', 'setSectionResizeMode', 'translate', 'wrapInstance']

This is with Qt.py version 1.1.0.

I haven’t found a workaround so far… 😢

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fredrikaverpilcommented, Jun 1, 2018

Another workaround, using a PyInstaller hook. Add a hook hook-Qt.py with contents:

hiddenimports = ["PySide2.QtXml", "PySide2.QtUiTools"]

This triggers the imports in hiddenimports on import Qt and makes Qt.QtCompat.loadUi available as expected.

0reactions
fredrikaverpilcommented, May 31, 2018

Oops! Classic copy/paste mistake. Sorry. I’ll switch those two lines around.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pyinstaller standalone executable cannot find ui file defined in ...
I'm using pyinstaller to compile a standalone executable file. The python script uses an external ui file from QtDesigner. I don't get it...
Read more >
How to include ui-Files? - Google Groups
Is there a way to let a PyInstaller onefile include ... And when calling the onefile in a way that makes it available...
Read more >
Python Examples of sip.setapi - ProgramCreek.com
This page shows Python examples of sip.setapi.
Read more >
Python getapi Examples
Python getapi - 30 examples found. ... File: qtcompat.py Project: amela/orange3 ... if you want to use PyInstaller, find this file: ...
Read more >
vocab.txt - Hugging Face
... zip getattr ##ender ##ely control stats variables ##nown ##32 ##ential whether vis io ##info math ndarray ##pth ##uid missing report ##ugh cent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found