pyinstaller / pyinstaller/pyinstaller

Manifest With "requireAdministrator" Doesn't Require Administrator

Open
#9,341 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:documentation
Dominant language
Python
Stars
13.1k
Forks
2k
Avg merge
1d 3h
Merged PRs (30d)
11

Description

Description of the issue

I am trying to have my GUI program prompt the user for administrative permissions on Windows (UAC), so I have a manifest file to specify that. However, it doesn't prompt UAC in any case I've tried (onedir, onefile, etc).

Context information (for bug reports)
  • Output of pyinstaller --version: 6.17.0
  • Version of Python: 3.13.1
  • Platform: Windows (English)
  • How you installed Python: python.org/downloads
  • Did you also try this on another platform? No
Make sure everything is packaged correctly
  • start with clean installation
  • use the latest development version
  • Run your frozen program from a command window (shell) — instead of double-clicking on it
  • Package your program in --onedir mode
  • Package without UPX, say: use the option --noupx or set upx=False in your .spec-file
  • Repackage you application in verbose/debug mode. For this, pass the option --debug to pyi-makespec or pyinstaller or use EXE(..., debug=1, ...) in your .spec file.
A minimal example program which shows the error
gui.py
print("hello world")
gui.spec
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
    ['gui.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
    optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='gui',
    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,
    manifest='gui.exe.manifest',
)
gui.exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
                <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
            </requestedPrivileges>
        </security>
    </trustInfo>
</assembly>

Stacktrace / full error message

There is no formal error message. The program should prompt UAC, but doesn't.

out.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report using gui.spec, gui.py, and gui.exe.manifest with PyInstaller 6.17.0 on Windows, then inspect the generated executable and its embedded manifest. Confirm whether the requireAdministrator setting is preserved in onedir and onefile builds; done means the packaged program consistently triggers the expected UAC prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.