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

Creation of a single file executable fail, if the total size of the included files is above 2 GB (windows 10) #5264

Closed
theshinyknight opened this issue Oct 20, 2020 · 3 comments

Comments

@theshinyknight
Copy link

theshinyknight commented Oct 20, 2020

Description of the issue

If you create a single file executable, which contains assets and code, and its total size is above 2 GB, the operation will fail.

PyInstaller: 4.0
Python: 3.7.9
Platform: Windows-10-10.0.19041-SP0

Expected result:
The build is successful, independently from the total size of the executable

Actual result:
If the total size of all the files in the single executable is less than 2 GB, everything works fine; if you add more than 2 GB in assets, the process will fail when generating the pkg:

30283 INFO: checking PKG 30283 INFO: Building PKG because PKG-00.toc is non existent 30283 INFO: Building PKG (CArchive) PKG-00.pkg Traceback (most recent call last): File "c:\python379\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "c:\python379\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\python379\Scripts\pyinstaller.exe\__main__.py", line 7, in <module> File "c:\python379\lib\site-packages\PyInstaller\__main__.py", line 114, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\python379\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\python379\lib\site-packages\PyInstaller\building\build_main.py", line 720, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "c:\python379\lib\site-packages\PyInstaller\building\build_main.py", line 667, in build exec(code, spec_namespace) File "auto_tools.spec", line 33, in <module> console=True , icon='app2.ico') File "c:\python379\lib\site-packages\PyInstaller\building\api.py", line 437, in __init__ upx_exclude=self.upx_exclude File "c:\python379\lib\site-packages\PyInstaller\building\api.py", line 200, in __init__ self.__postinit__() File "c:\python379\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__ self.assemble() File "c:\python379\lib\site-packages\PyInstaller\building\api.py", line 285, in assemble pylib_name=pylib_name) File "c:\python379\lib\site-packages\PyInstaller\archive\writers.py", line 332, in __init__ super(CArchiveWriter, self).__init__(archive_path, logical_toc) File "c:\python379\lib\site-packages\PyInstaller\archive\writers.py", line 64, in __init__ self._finalize() File "c:\python379\lib\site-packages\PyInstaller\archive\writers.py", line 96, in _finalize self.save_trailer(toc_pos) File "c:\python379\lib\site-packages\PyInstaller\archive\writers.py", line 439, in save_trailer tocstr = self.toc.tobinary() File "c:\python379\lib\site-packages\PyInstaller\archive\writers.py", line 264, in tobinary flag, ord(typcd), nm + pad)) struct.error: argument out of range

Steps to reproduce:
In a PY file, add references to local folders (like /images and /movies for example), fill those folders with enough files to go beyond 2.1 GB in total.
run pyinstaller on the PY file to generate the spec file; open the spec file and add those 2 folders to the datas entry

mydata = [("audio", "audio"), ("videos", "videos")]
...
datas=mydata

Then run pyinstaller again, using the spec file. The process will fail with the struct.error: argument out of range.

Counter-test:
Same setup, remove data from the audio and video folders, so the total will be below 2 GB, run pyinstaller again using the spec file. This time the build will be successful; proving that the issue is the size of the total files when creating a single file executable. The largest exe I was able to create is 2.07 GB, adding another file which had 500 MB in size would trigger the error

@bwoodsend
Copy link
Member

Duplicate of #3939.

@theshinyknight
Copy link
Author

Hi,
That ticket is from 2018; it was closed with an expected release for 4.0 (the current version). Aren't tickets for bugs closed when the bug is actually solved? I am confused. Thanks

@bwoodsend
Copy link
Member

No that ticket is still open.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants