Why does my pyinstaller created executable require admin privileges?
admin privileges could be asked in few cases:
A. if the executable name contains relevant keywords (like setup
, install
, update
or patch
)
B. the application requests it in it's manifest.
C. the .exe file name do not match the name in the manifest file.
if you create a .spec file for your application package, you can add
exe = EXE(
...
manifest=None,
...
)
and it won't ask for password, unless you rename it to setup or install.
I have recently run into this issue, and my experience in solving it was thus:
PyInstaller with --onefile
option creates a manifest file in the 'executable'. This manifest file on Windows tells the OS a few things about the application it is bundled with. One of the things it specifies, is the application name/manifest file. The format of the manifest filename is appname.exe.manifest
. If your program is frozen with PyInstaller, the executable name that it stores in the manifest will be the name given to the completed EXE under the /dist
folder of PyInstaller. IF you rename the EXE, the manifest file packed with it is no longer matching! Therefore, create a manifest file with the same name as the final EXE filename and run PyInstaller with the --manifest
option, OR don't rename the EXE that PyInstaller creates.
When you package the PyInstaller project with the custom --manifest
, the renamed program no longer requests administrator elevation.