marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.35k stars 218 forks source link

PyQt5 + python3.3 + cx_freeze4.3.2 #51

Closed anthony-tuininga closed 4 years ago

anthony-tuininga commented 10 years ago

Originally reported by: phreaking (Bitbucket: phreaking, GitHub: phreaking)


Full desc about the problem. Stackoverflow

I'm running in circles with a really strange thing happen. Basically I'm trying a simple window app with PyQt5+python3.3+cx_freeze4.3.2. The problem runs perfect calling the python:

python test.py

Now the second part the basic setup.py to the cx_freeze:

#!python

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == 'win32':
    base = 'Win32GUI'

options = {
    'build_exe': {
        'includes': 'atexit'
    }
}

executables = [
    Executable('test.py', base=base)
]

setup(name='test',
      version='0.1',
      description='test',
      options=options,
      executables=executables
      )

build it:

python test.py build

The follow folder is created:

build/exe.win32-3.3:

/platforms /imageformats test.exe icudt49.dll icuin49.dll icuuc49.dll libGLESv2.dll library.zip PyQt5.QtCore.pyd PyQt5.QtGui.pyd PyQt5.QtWidgets.pyd python33.dll Qt5Core.dll Qt5Gui.dll Qt5Widgets.dll sip.pyd unicodedata.pyd _bz2.pyd

Now running test.exe everything works fine as it should.

The problem comes when I copy the build folder to other PC. An error pops-up when I run the test.exe

This application failed to start because it could not find or load the QT platform plugin "windows".

Available platform plugin are: minimal, offscreen, windows.

Reinstalling the application may fix this problem

According everything I read it's about dlls on plataforms/ the .exe don't find qwindow.dll inside. Why it's only happen in other PC (win7)?? The developement PC (win7) works fine. To debug it and to have sure that qwindow.dll used is the one inside on plataforms/ I rename the folder to plataformFOO/ and try run the test.exe and now same problem in dev PC, so, the dll is in correct folder, rename it back to plataforms/ and everything working fine. Why the hell is not working in others PCs if the OS is the same and the folder is a simple copy of the one on dev PC.

I google, read loads of stuffs but can't figure out the problem. If someone can help ;)


anthony-tuininga commented 10 years ago

Original comment by Aaron Brice (Bitbucket: aaron_brice, GitHub: Unknown):


See pull request #66

anthony-tuininga commented 10 years ago

Original comment by Aaron Brice (Bitbucket: aaron_brice, GitHub: Unknown):


Yes, I can do that today.

anthony-tuininga commented 10 years ago

Original comment by Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver):


@aaron_brice posted a message investigating the details and a potential fix. I have it in my email, but it appears to have disappeared from here.

I think he found the issue. When you use finder.IncludeFiles() to copy a directory, as we do for directories of Qt plugins, it assumes that the contents of the directory are not libraries, so it copies them with copyDependentFiles=False. I think we can just change that to True. It should be safe to call _GetDependentFiles() on non-libraries - it should just return nothing.

Aaron, do you want to make a pull request?

anthony-tuininga commented 10 years ago

Original comment by Nikolay Golub (Bitbucket: ngolub, GitHub: Unknown):


I think it's exactly the same problem, because it was solved by copying the libEGL.dll from PyQt5 folder to build folder on target machine, as phreaking has said.

I'll try to investigate, why cx_Freeze do not copy this lib.

anthony-tuininga commented 10 years ago

Original comment by Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver):


First, check that what you see is really exactly the same problem. If it's different, then start another issue with the details.

Next, get the development version of cx_Freeze to see if the problem is still there. If you're on Windows, you'll need the appropriate version of Visual Studio to build Python extensions (VS 2008 for Python 2.7, 2010 for Python 3.4).

Then, dig into cx_Freeze code to see what it's doing. The important modules are:

anthony-tuininga commented 10 years ago

Original comment by Nikolay Golub (Bitbucket: ngolub, GitHub: Unknown):


It was merged 2013-11-30, I use version 4.3.3, which has been created 2014-05-04, so I think this merge doesn't solves the problem.

How can I help to investigation process?

anthony-tuininga commented 10 years ago

Original comment by Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver):


The PR I referenced got merged, so this should be fixed. If it's not, then my assessment of the problem was wrong, and we'll need to work out what the real issue is.

anthony-tuininga commented 10 years ago

Original comment by Nikolay Golub (Bitbucket: ngolub, GitHub: Unknown):


So currently, there is no way to produce working msi with bdist_msi command?

anthony-tuininga commented 10 years ago

Original comment by Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver):


I think the root cause is that libraries in subfolders (such as Qt plugins) aren't checked for dependencies. See also the discussion in pull request #23.

anthony-tuininga commented 10 years ago

Original comment by phreaking (Bitbucket: phreaking, GitHub: phreaking):


Problem can be fixed copy the libEGL.dll from PyQt5 folder to build folder

marcelotduarte commented 4 years ago

Closing due to inactivity. cx_Freeze 6.1 has just been released.