FooSoft / mangle

Manga processor for the Kindle e-book reader.
https://foosoft.net/projects/mangle
Other
124 stars 24 forks source link

Can anyone help figure out how to build a binary for the Python3 port? #46

Open axu2 opened 3 years ago

axu2 commented 3 years ago

@gigajosh

The Python3 port is just a copy paste of your branch, do you know how?

clach04 commented 3 years ago

@axu2 I've had great success with pyinstaller on other py3 projects on Windows.

py -3 -m pip install pyinstaller
pyinstaller SCRIPT_NAME_HERE.py

I once had an issue that required a not-yet released build, pip installable via:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
axu2 commented 3 years ago

Can you try building it yourself? I can't figure it out. Here's my python 3 fork. The exe that gets build just closes immediately when I try, even though running py -3 mangle.pyw works fine.

https://github.com/FooSoft/mangle/pull/45

clach04 commented 3 years ago

@axu2 I do NOT have PyQT, so I took your py3 branch combined with my cli branch and created

I then created an exe and posted to:

Created as described above with Python 3.7.3:

(py38) C:\code\py\mangle>python -m pip install pyinstaller
Collecting pyinstaller
  Downloading pyinstaller-4.4-py3-none-win_amd64.whl (2.0 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 2.0 MB 731 kB/s
Collecting pefile>=2017.8.1
  Downloading pefile-2021.5.24.tar.gz (66 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 66 kB 1.5 MB/s
Collecting altgraph
  Downloading altgraph-0.17-py2.py3-none-any.whl (21 kB)
Collecting pywin32-ctypes>=0.2.0
  Using cached pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)
Requirement already satisfied: setuptools in c:\py38\lib\site-packages (from pyinstaller) (40.8.0)
Requirement already satisfied: importlib-metadata in c:\py38\lib\site-packages (from pyinstaller) (4.6.1)
Collecting pyinstaller-hooks-contrib>=2020.6
  Downloading pyinstaller_hooks_contrib-2021.2-py2.py3-none-any.whl (190 kB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 190 kB 819 kB/s
Collecting future
  Using cached future-0.18.2.tar.gz (829 kB)
Requirement already satisfied: zipp>=0.5 in c:\py38\lib\site-packages (from importlib-metadata->pyinstaller) (3.5.0)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\py38\lib\site-packages (from importlib-metadata->pyinstaller) (3.10.0.0)
Using legacy 'setup.py install' for pefile, since package 'wheel' is not installed.
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Installing collected packages: future, pywin32-ctypes, pyinstaller-hooks-contrib, pefile, altgraph, pyinstaller
    Running setup.py install for future ... done
    Running setup.py install for pefile ... done
Successfully installed altgraph-0.17 future-0.18.2 pefile-2021.5.24 pyinstaller-4.4 pyinstaller-hooks-contrib-2021.2 pywin32-ctypes-0.2.0

(py38) C:\code\py\mangle>pyinstaller  mangle-cli.py
115 INFO: PyInstaller: 4.4
116 INFO: Python: 3.7.3
119 INFO: Platform: Windows-10-10.0.19041-SP0
120 INFO: wrote C:\code\py\mangle\mangle-cli.spec
131 INFO: UPX is not available.
137 INFO: Extending PYTHONPATH with paths
['C:\\code\\py\\mangle', 'C:\\code\\py\\mangle']
164 INFO: checking Analysis
164 INFO: Building Analysis because Analysis-00.toc is non existent
168 INFO: Initializing module dependency graph...
172 INFO: Caching module graph hooks...
213 INFO: Analyzing base_library.zip ...
5183 INFO: Caching module dependency graph...
5385 INFO: running Analysis Analysis-00.toc
5409 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\Users\clach04\AppData\Local\Programs\Python\Python37\python.exe
5520 INFO: Analyzing C:\code\py\mangle\mangle-cli.py
6666 INFO: Processing pre-find module path hook distutils from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
6667 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\clach04\\AppData\\Local\\Programs\\Python\\Python37\\lib'
8797 INFO: Processing pre-find module path hook site from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
8799 INFO: site: retargeting to fake-dir 'c:\\py38\\lib\\site-packages\\PyInstaller\\fake-modules'
10800 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hoo
k-setuptools.extern.six.moves.py'.
12590 INFO: Processing module hooks...
12591 INFO: Loading module hook 'hook-pycparser.py' from 'c:\\py38\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
12595 INFO: Loading module hook 'hook-difflib.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12598 INFO: Loading module hook 'hook-distutils.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12603 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12608 INFO: Loading module hook 'hook-encodings.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12727 INFO: Loading module hook 'hook-heapq.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12729 INFO: Loading module hook 'hook-importlib_metadata.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12733 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12839 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12841 INFO: Import to be excluded not found: 'test'
12843 INFO: Loading module hook 'hook-pickle.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
12846 INFO: Loading module hook 'hook-PIL.Image.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
13623 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
13626 INFO: Loading module hook 'hook-PIL.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
13630 INFO: Import to be excluded not found: 'PyQt6'
13630 INFO: Import to be excluded not found: 'PySide6'
13638 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
13641 INFO: Loading module hook 'hook-pkg_resources.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
14284 INFO: Processing pre-safe import module hook win32com from 'c:\\py38\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-wi
n32com.py'.
14349 WARNING: Hidden import "pkg_resources.py2_warn" not found!
14350 WARNING: Hidden import "pkg_resources.markers" not found!
14355 INFO: Loading module hook 'hook-setuptools.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15037 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15039 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15261 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15263 INFO: Loading module hook 'hook-xml.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15266 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15528 INFO: checking Tree
15528 INFO: Building Tree because Tree-00.toc is non existent
15531 INFO: Building Tree Tree-00.toc
15734 INFO: checking Tree
15735 INFO: Building Tree because Tree-01.toc is non existent
15738 INFO: Building Tree Tree-01.toc
15874 INFO: checking Tree
15875 INFO: Building Tree because Tree-02.toc is non existent
15878 INFO: Building Tree Tree-02.toc
15893 INFO: Loading module hook 'hook-setuptools.msvc.py' from 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks'...
15926 INFO: Looking for ctypes DLLs
15960 INFO: Analyzing run-time hooks ...
15964 INFO: Including run-time hook 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py'
15968 INFO: Including run-time hook 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
15972 INFO: Including run-time hook 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
15983 INFO: Including run-time hook 'c:\\py38\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
16002 INFO: Looking for dynamic libraries
16421 INFO: Looking for eggs
16422 INFO: Using Python library C:\Users\clach04\AppData\Local\Programs\Python\Python37\python37.dll
16425 INFO: Found binding redirects:
[]
16439 INFO: Warnings written to C:\code\py\mangle\build\mangle-cli\warn-mangle-cli.txt
16536 INFO: Graph cross-reference written to C:\code\py\mangle\build\mangle-cli\xref-mangle-cli.html
16562 INFO: checking PYZ
16562 INFO: Building PYZ because PYZ-00.toc is non existent
16563 INFO: Building PYZ (ZlibArchive) C:\code\py\mangle\build\mangle-cli\PYZ-00.pyz
17491 INFO: Building PYZ (ZlibArchive) C:\code\py\mangle\build\mangle-cli\PYZ-00.pyz completed successfully.
17515 INFO: checking PKG
17515 INFO: Building PKG because PKG-00.toc is non existent
17516 INFO: Building PKG (CArchive) PKG-00.pkg
17552 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
17554 INFO: Bootloader c:\py38\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
17558 INFO: checking EXE
17563 INFO: Building EXE because EXE-00.toc is non existent
17564 INFO: Building EXE from EXE-00.toc
17636 INFO: Copying icons from ['c:\\py38\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico']
17706 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
17706 INFO: Writing RT_ICON 1 resource with 3752 bytes
17709 INFO: Writing RT_ICON 2 resource with 2216 bytes
17710 INFO: Writing RT_ICON 3 resource with 1384 bytes
17718 INFO: Writing RT_ICON 4 resource with 37019 bytes
17718 INFO: Writing RT_ICON 5 resource with 9640 bytes
17719 INFO: Writing RT_ICON 6 resource with 4264 bytes
17720 INFO: Writing RT_ICON 7 resource with 1128 bytes
17723 INFO: Appending archive to EXE C:\code\py\mangle\build\mangle-cli\mangle-cli.exe
18733 INFO: Building EXE from EXE-00.toc completed successfully.
18736 INFO: checking COLLECT
18737 INFO: Building COLLECT because COLLECT-00.toc is non existent
18738 INFO: Building COLLECT COLLECT-00.toc
19811 INFO: Building COLLECT COLLECT-00.toc completed successfully.
clach04 commented 3 years ago

Also check out https://github.com/mherrmann/fbs (I'm not sure if this supports py3 though, but it covers more than just exe generation)

axu2 commented 3 years ago

Why don't you just pip install pyqt5? EDIT: just tried didn't work with pyinstaller

PyQt4 for python2 was the one that was hard to install.

(Though seeing as how you got it to work without PyQT5 indicates that PyQT5 is the problem).

Just updated all my dependencies, still no dice with

pyinstaller mangle.pyw

axu2 commented 3 years ago

To debug this one could try removing parts of the app/strip it down until it works.

clach04 commented 3 years ago

Hi @axu2 it looks like there are specific hook-PyQt5.py in PyInstaller, there is a warning in the build log about missing sip. So that would probably be a good place to start looking.

I tried your suggestion, exe builds but runs and exits silently. I don't have an interest in this (I want headless, to run on an SBC) but if it were me, I'd be tempted to debug with pdb (logging statements, etc.) in the generated exe to trace what is happening rather than stripping/removing parts (but that's a valid technique as well :)). Good luck with this, if you think its PyQT5 specific opening a ticket with PyInstaller or upstream PyQt5 may be worth a shot once you have an idea where the error is happening (at the moment the error is getting hidden).

axu2 commented 3 years ago

Just tried with 32 bit Python 3 with same result. Thought it was worth a shot since the Python2 version of py2exe only supported 32 bit.

gigajosh commented 3 years ago

@gigajosh

The Python3 port is just a copy paste of your branch, do you know how?

Sorry, haven't been keeping up with my Github notifications.. I'm afraid I was just running the app with python. So can't help with an exe I'm afraid.

axu2 commented 3 years ago

Ah well, was hoping you had some insight since I saw PyBuilder stuff in there. I removed that in my branch.