Guides • PyInstaller

Bundle data files correctly with PyInstaller (and avoid broken paths)

Ship images, configs, models, and templates safely; fix path issues at runtime with a clean pattern.

Get PyInstaller GUI All guides

The problem

Hard-coded relative paths often break after packaging. Onefile also extracts files to a temp directory, so your runtime path changes.

The clean pattern

  • Include assets using PyInstaller’s data-file options.
  • Resolve the runtime base directory in code and build paths from it.

What to bundle

  • UI assets (icons, images)
  • Config templates
  • ML models
  • Default data files

Tip: In PyInstaller GUI, keep assets grouped and add them as a folder to avoid missing individual files later.

Need help with your exact build?

Send your PyInstaller command + the last 50 lines of the build log.

Contact support