Is your feature request related to a problem? Please describe.
Not sure if a bug, or more of a Feature Request to either add special numpy strip support, or adding a flag similar to --upx-exclude
I've made sure to pass --noupx and disabled my manual upx compression to isolate the issue to the --strip flag.
Builds on my local machine (Kubuntu 26.04) work perfectly fine, but downloading a build from my CI (GitHub Ubuntu 22.04) surprisingly results in the following issue when starting:
OpenCV bindings requires "numpy" package.
Install it via command:
pip install numpy
Traceback (most recent call last):
File "numpy/_core/__init__.py", line 22, in <module>
File "pyimod02_importers.py", line 457, in exec_module
File "numpy/_core/multiarray.py", line 11, in <module>
ImportError: libscipy_openblas64_-8fb3d286.so: ELF load command address/offset not page-aligned
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "numpy/__init__.py", line 112, in <module>
File "pyimod02_importers.py", line 457, in exec_module
File "numpy/__config__.py", line 4, in <module>
File "pyimod02_importers.py", line 457, in exec_module
File "numpy/_core/__init__.py", line 48, in <module>
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.14 from "/tmp/.mount_AutoSpWPhsRo/AppRun"
* The NumPy version is: "2.3.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libscipy_openblas64_-8fb3d286.so: ELF load command address/offset not page-aligned
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "AutoSplit.py", line 37, in <module>
File "/tmp/.mount_AutoSpWPhsRo/_internal/cv2/__init__.py", line 11, in <module>
import numpy
File "pyimod02_importers.py", line 457, in exec_module
File "numpy/__init__.py", line 117, in <module>
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
[PYI-213660:ERROR] Failed to execute script 'AutoSplit' due to unhandled exception!
Describe the solution you'd like
Some way for --strip to just work without manual file copy workarounds. (exclude flag or contrib hook?)
Describe alternatives you've considered
I end up manually re-copying the broken numpy.libs after running pyinstaller with --strip --onedir. This obviously wouldn't work in --onefile.
# PyInstaller's --strip breaks ELF load command alignment in all of numpy's vendored libs.
# Restore all original unstripped libraries from site-packages.
$numpyLibsSrc = uv run --active python -c "import numpy, pathlib; print(pathlib.Path(numpy.__file__).parent.parent / 'numpy.libs')"
if (Test-Path $numpyLibsSrc) {
Copy-Item -Path "$numpyLibsSrc/*" -Destination 'build/AppDir/_internal/numpy.libs/' -Force
}
Additional context
For reproducibility, here's an exact commit with UPX disables, --strip enabled, and workaround in my build script:
`uv pip freeze`
altgraph==0.17.4
ast-serialize==0.5.0
beslogic-ruff-config @ git+https://github.com/Beslogic/Beslogic-Ruff-Config@312cfab8a1e2653639a2ef665e99eac6c7412ba7
dprint-py==0.52.0.0
ewmhlib==0.2
keyboard @ git+https://github.com/boppreh/keyboard.git@d232de09bda50ecb5211ebcc59b85bc6da6aaa24
levenshtein==0.27.3
librt==0.11.0
mypy==2.1.0
mypy-extensions==1.1.0
nodeenv==1.9.1
nodejs-wheel-binaries==22.17.0
numpy==2.3.2
opencv-contrib-python-headless==4.11.0.86
packaging==25.0
pathspec==1.1.1
pillow==12.2.0
pyautogui==0.9.54
pyinstaller==6.17.0
pyinstaller-hooks-contrib==2025.10
pymonctl==0.92
pyright==1.1.410
pyside6-essentials==6.9.1
python-xlib==0.33
pywinbox==0.7
pywinctl==0.4.1
rapidfuzz==3.14.5
ruff==0.15.14
setuptools==80.9.0
shiboken6==6.9.1
six==1.17.0
tomli-w==1.2.0
types-keyboard==0.13.2.20250801
types-pyautogui==0.9.3.20241230
types-pyinstaller==6.19.0.20260215
types-python-xlib==0.33.0.20250809
typing-extensions==4.14.1
Is your feature request related to a problem? Please describe.
Not sure if a bug, or more of a Feature Request to either add special numpy strip support, or adding a flag similar to --upx-exclude
I've made sure to pass
--noupxand disabled my manual upx compression to isolate the issue to the--stripflag.Builds on my local machine (Kubuntu 26.04) work perfectly fine, but downloading a build from my CI (GitHub Ubuntu 22.04) surprisingly results in the following issue when starting:
Describe the solution you'd like
Some way for
--stripto just work without manual file copy workarounds. (exclude flag or contrib hook?)Describe alternatives you've considered
I end up manually re-copying the broken
numpy.libsafter running pyinstaller with--strip --onedir. This obviously wouldn't work in--onefile.Additional context
For reproducibility, here's an exact commit with UPX disables,
--stripenabled, and workaround in my build script:pyinstaller src/AutoSplit.py --noconfirm --windowed --optimize=2 --additional-hooks-dir=Pyinstaller/hooks --add-data=pyproject.toml:. --icon=res/icon.ico --noupx --splash=res/splash.png --distpath=build/AppDir --strip`uv pip freeze`
altgraph==0.17.4 ast-serialize==0.5.0 beslogic-ruff-config @ git+https://github.com/Beslogic/Beslogic-Ruff-Config@312cfab8a1e2653639a2ef665e99eac6c7412ba7 dprint-py==0.52.0.0 ewmhlib==0.2 keyboard @ git+https://github.com/boppreh/keyboard.git@d232de09bda50ecb5211ebcc59b85bc6da6aaa24 levenshtein==0.27.3 librt==0.11.0 mypy==2.1.0 mypy-extensions==1.1.0 nodeenv==1.9.1 nodejs-wheel-binaries==22.17.0 numpy==2.3.2 opencv-contrib-python-headless==4.11.0.86 packaging==25.0 pathspec==1.1.1 pillow==12.2.0 pyautogui==0.9.54 pyinstaller==6.17.0 pyinstaller-hooks-contrib==2025.10 pymonctl==0.92 pyright==1.1.410 pyside6-essentials==6.9.1 python-xlib==0.33 pywinbox==0.7 pywinctl==0.4.1 rapidfuzz==3.14.5 ruff==0.15.14 setuptools==80.9.0 shiboken6==6.9.1 six==1.17.0 tomli-w==1.2.0 types-keyboard==0.13.2.20250801 types-pyautogui==0.9.3.20241230 types-pyinstaller==6.19.0.20260215 types-python-xlib==0.33.0.20250809 typing-extensions==4.14.1