Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for PySide2 in standalone mode #170

Closed
aoloe opened this issue Oct 10, 2018 · 8 comments
Closed

No support for PySide2 in standalone mode #170

aoloe opened this issue Oct 10, 2018 · 8 comments
Labels
bug delayed This is waiting for something else to be done first. help wanted Please help with this, we think you can

Comments

@aoloe
Copy link

aoloe commented Oct 10, 2018

Before submitting an Issue, please review the Issue Guidelines.

  • could not find a match in this tracker for "QtGui"
  • Successfully installed Nuitka-0.6.1rc5 through pip in a venv
nuitka3 --version
0.6.1rc5
Python: 3.6.6 (default, Jun 27 2018, 14:44:17)
Executable: /home/ale/src-tmp/python-tutorial-qt/venv/bin/python3
OS: Linux
Arch: x86_64

the python code

from PySide2.QtWidgets import QApplication, QLabel

app = QApplication([])
label = QLabel('Hello World')
label.show()
app.exec_()

compiled with

python -m nuitka --recurse-all --standalone hello-world.py

zipped the resulting hello-world.dist and copied it on a different computer.

unzipped and:

$ ./hello-world
Traceback (most recent call last):
  File "/home/ale/t/hello-world.dist/hello-world.py", line 1 <module>
ImportError: could not import module 'PySide2.QtGui'

if i run

$ python -m nuitka --recurse-all hello-world.py

i can correctly run the resulting hello-world.bin on the same machine, even if i'm not in the virtual environment.

i can provide the zip file, if it is useful for you...

@kayhayen
Copy link
Member

There is a plugin in Nuitka that deals with implicit imports and handles these for PyQt5 and PySide already.

Recently I noticed that PyQt5 provides so called ".pyi "files, which (with upcoming fixes that I have yet to push to factory and pre-release this weekend) which seem to provide all the hidden dependencies.

Can we try and convince PySide2 makers, which is apparently the Qt project now to provide these, so we don't have to hard code them in Nuitka (and in everything else on the planet that attempts to package it)?

Otherwise, feel free to search "PySide" in Nuitka and extend it for PySide2 too as well, and very likely things will work. The "plugins" code will need to be adapted to recognize it either way.

@kayhayen kayhayen added bug help wanted Please help with this, we think you can labels Oct 13, 2018
@kayhayen kayhayen changed the title "could not import module PySide2.QtGui" for standalone executable No support for PySide2 in standalone mode Oct 13, 2018
@kayhayen
Copy link
Member

If you are willing to make a PR for Nuitka, I can help you get this done, it's not rocket science, but for the implicit imports, I would very much prefer to talk to PySide2 makers for them to provide files with these hidden imports in them.

As PySide2 seems unfinished, I am not going to care all that much about it, esp. as I had bad experience with getting PySide patches merged in the past. Could well be that PySide2 still hard codes uncompiled function type checks like PySide did.

@ManPython

This comment has been minimized.

@kayhayen

This comment has been minimized.

@kayhayen kayhayen added the delayed This is waiting for something else to be done first. label Oct 16, 2018
@girstenbrei
Copy link

Hi there!
I have the same problem as @aoloe (I think). I can reproduce the failure (Windows 10, Nuitka 0.6.0.6 via pip, PySide2 5.11.2, Python 3.7.1). But I explicitely use something from the QtGui module (QPixmap) and that seems to solve the import issue. This leaves me with the following error:

qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Thought maybe I get lucky, copying the qt-plugins folder (containing a platforms-folder) into the PySide2 folder (giving me .\xyz.dist\PySide2\qt-plugins\platforms, but thats not enough apparently.

I may be able to provide you with a PR, don't know much about Nuitka unfortunately, neither about PySide2, but adapting nuitka/plugins/standard/PySidePyQtPlugin.py, I may be able to do that. Just wanted to ask if someone knew the error from above, what it means and if there are any gotyas for adapting the plugin?

PS: @kayhayen (and all other contributors) really really really awesome work! Appart from other advantages I think Nuitka completes the python eco system: why would I use pyinstaller/cx_freeze/aso. when I can get all the advantages of a compiled piece of software? I think it's great!

@kayhayen
Copy link
Member

@girstenbrei sorry for not getting back to you sooner. I invite you to check out the PySide/PyQt plugin in nuitka/plugins and try to adapt it for PySide2. There is a high chance adding support for PySide2 is not that hard. The errors you get are the same you will be getting without the plugin with PyQt and PySide1.

Looking forward to your pull request.

Yours,
Kay

@taimurrabuske
Copy link

Hello. I submitted a pull request.
#205
https://github.com/taimurrabuske/Nuitka/commit/34fd2262edbc56b0698333320a35e5ea2ed93e73

I managed to make it work with a simple hello-world PySide2 example.

import sys
from PySide2.QtWidgets import QApplication, QLabel

app = QApplication(sys.argv)
#label = QLabel("Hello World!")
label = QLabel("Hello World!")
label.show()
app.exec_()

@kayhayen
Copy link
Member

When https://bugreports.qt.io/browse/PYSIDE-1523 is included PySide will be good with Nuitka. There is experimental support for PySide2 right now, but it has a few bugs. Closing this as a duplicate.

@Nuitka Nuitka locked and limited conversation to collaborators Oct 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug delayed This is waiting for something else to be done first. help wanted Please help with this, we think you can
Projects
None yet
Development

No branches or pull requests

5 participants