Skip to content

setup.ps1 forced Administrator elevation breaks PaddleOCR installation for standard users #18

@businesslogic360

Description

@businesslogic360

Description

Currently, the setup.ps1 script forces an auto-elevation check to Administrator at the very beginning of the script. While this is necessary for installing Windows Context Menu entries (which require writing to HKLM), it completely breaks the PaddleOCR installation for standard (non-admin) users.

Because the script elevates to an Administrator profile via UAC, the PaddleOCR virtual environment (paddleocr-venv) and models are downloaded and installed into the Administrator's %LOCALAPPDATA% (e.g., C:\Users\Administrator\AppData\Local\autorename-pdf\paddleocr-venv).

When the standard user subsequently runs autorename-pdf-cli.exe, the tool looks for the venv in the standard user's profile, fails to find it, and throws the warning: ⚠ PaddleOCR not installed — run setup.ps1 to install.

Steps to Reproduce

  1. Log into Windows as a Standard User (non-admin account).
  2. Open PowerShell and run .\setup.ps1.
  3. The script triggers a UAC prompt. Enter the Administrator credentials to proceed.
  4. Choose y to install PaddleOCR.
  5. Once the installation is complete, open a normal (non-elevated) command prompt or PowerShell.
  6. Run a dry run requiring OCR: autorename-pdf-cli.exe rename "C:\Path\To\PDFs" --ocr --dry-run
  7. Expected behavior: The tool uses PaddleOCR to extract text.
  8. Actual behavior: The tool fails with PaddleOCR requested but not available because the standard user cannot access the admin's AppData folder where the engine was actually installed.

Proposed Solution

Do not force a blanket Administrator elevation at the start of the script. Instead:

  1. Ask the user if they want to install the Windows Context Menu entries first.
  2. Only request UAC elevation specifically for the registry modification portion of the script if they say "Yes" to the context menus.
  3. Allow the PaddleOCR installation block to run as the current/standard user so the paddleocr-venv is correctly mapped to the user who is actually running the tool.

Workaround Used

Manually editing setup.ps1 to comment out the Administrator elevation block allows the standard user to install PaddleOCR successfully into their own %LOCALAPPDATA% directory, resolving the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions