Hello, thanks for building this software. I am build a flask app into a single file for running on a Raspberry Pi. I'm building on a Raspberry Pi (a different one, but same os etc). I get failures trying to build about 70% of the time. I've tried lots of different combinations, but often it will work, then fail, then fail then work. Googling the error messages turned up very little and nothing relevant that I can find.
I've tried many combinations of `rm -r build/ dist/ serve.spec` and so on. Sometimes it works, sometimes it doesn't. Sometimes it works then it doesn't, and other times it doesn't work and does.
Information is below, and thank you for your time in advance.
Short version:
Running command:
$ pyinstaller --onefile --add-data 'templates:templates' --add-data 'static:static' serve.py --log-level DEBUG
$ uname -a
Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux
$ python --version
Python 3.7.3
(in a virtualenv)
Last line of error message when it does fail (see below for full output):
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/depend/bindepend.py", line 800, in _which_library
for _path in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/lib32'
Long Version:
The following two logs were from running the command immediately again. The first time fails, the second works (running the command again fails several times in a row):
$ pyinstaller --onefile --add-data 'templates:templates' --add-data 'static:static' serve.py --log-level DEBUG
201 INFO: PyInstaller: 5.0.dev0+ae7ed8ed04
201 INFO: Python: 3.7.3
210 INFO: Platform: Linux-5.10.17-v7+-armv7l-with-debian-10.9
212 INFO: wrote /home/pi/project_folder/project/serve.spec
214 DEBUG: Testing for UPX ...
222 INFO: UPX is not available.
225 DEBUG: script: /home/pi/project_folder/project/serve.py
226 INFO: Extending PYTHONPATH with paths
['/home/pi/project_folder/project']
1032 INFO: checking Analysis
1108 INFO: Appending 'datas' from .spec
1120 INFO: checking PYZ
1164 INFO: checking PKG
1170 INFO: Building because toc changed
1170 INFO: Building PKG (CArchive) serve.pkg
Traceback (most recent call last):
File "/home/pi/packer/venv/bin/pyinstaller", line 11, in <module>
load_entry_point('pyinstaller==5.0.dev0+ae7ed8ed04', 'console_scripts', 'pyinstaller')()
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/__main__.py", line 124, in run
run_build(pyi_config, spec_file, **vars(args))
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/__main__.py", line 58, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/building/build_main.py", line 818, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/building/build_main.py", line 750, in build
exec(code, spec_namespace)
File "/home/pi/project_folder/project/serve.spec", line 43, in <module>
entitlements_file=None,
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/building/api.py", line 509, in __init__
entitlements_file=self.entitlements_file
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/building/api.py", line 204, in __init__
self.__postinit__()
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/building/datastruct.py", line 155, in __postinit__
self.assemble()
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/building/api.py", line 288, in assemble
pylib_name = os.path.basename(bindepend.get_python_library_path())
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/depend/bindepend.py", line 891, in get_python_library_path
python_libname = findLibrary(name)
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/depend/bindepend.py", line 769, in findLibrary
lib = _which_library(name, paths)
File "/home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/depend/bindepend.py", line 800, in _which_library
for _path in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/lib32'
(venv) pi@raspberrypi:~/projectfolder/project $ pyinstaller --onefile --add-data 'templates:templates' --add-data 'static:static' serve.py --log-level DEBUG
200 INFO: PyInstaller: 5.0.dev0+ae7ed8ed04
201 INFO: Python: 3.7.3
209 INFO: Platform: Linux-5.10.17-v7+-armv7l-with-debian-10.9
211 INFO: wrote /home/pi/project_folder/project/serve.spec
213 DEBUG: Testing for UPX ...
220 INFO: UPX is not available.
223 DEBUG: script: /home/pi/project_folder/project/serve.py
224 INFO: Extending PYTHONPATH with paths
['/home/pi/project_folder/project']
1034 INFO: checking Analysis
1103 INFO: Appending 'datas' from .spec
1114 INFO: checking PYZ
1158 INFO: checking PKG
1164 INFO: Building because toc changed
1164 INFO: Building PKG (CArchive) serve.pkg
1296 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/loader/pyiboot01_bootstrap.py
1297 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/loader/pyiboot01_bootstrap.py
1299 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py
1300 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py
1302 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_inspect.py
1302 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_inspect.py
1304 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py
1304 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py
1310 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py
1311 DEBUG: Compiling /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py
1313 DEBUG: Compiling /home/pi/project_folder/project/serve.py
1314 DEBUG: Compiling /home/pi/project_folder/project/serve.py
42321 INFO: Building PKG (CArchive) serve.pkg completed successfully.
42345 INFO: Bootloader /home/pi/packer/venv/lib/python3.7/site-packages/pyinstaller-5.0.dev0+ae7ed8ed04-py3.7.egg/PyInstaller/bootloader/Linux-32bit-arm/run
42346 INFO: checking EXE
42351 INFO: Building because toc changed
42352 INFO: Building EXE from EXE-00.toc
42372 INFO: Copying bootloader EXE to /home/pi/project_folder/project/dist/serve
42373 INFO: Appending PKG archive to ELF section in EXE
42594 DEBUG: objcopy returned 0
42595 INFO: Building EXE from EXE-00.toc completed successfully.
requirements.txt
pyserial
pyyaml
numpy
pynmea2
unicornhathd
nvector==0.7.6
geographiclib
pigpio
flask
flask-executor
waitress
pytest
Also included is:
smbus2
pijuice
(I just include these files in a separate dir in my app, as pip installing them didn't work well.)
serve.spec
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['serve.py'],
pathex=[],
binaries=[],
datas=[('templates', 'templates'), ('static', 'static')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='serve',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)