Skip to content

Make running from source work on Linux and macOS (fixes #2, #3) - #7

Open
TinNK3 wants to merge 1 commit into
notepower2k1:mainfrom
TinNK3:fix/cross-platform-linux-macos
Open

Make running from source work on Linux and macOS (fixes #2, #3)#7
TinNK3 wants to merge 1 commit into
notepower2k1:mainfrom
TinNK3:fix/cross-platform-linux-macos

Conversation

@TinNK3

@TinNK3TinNK3 commented Aug 18, 2026

Copy link
Copy Markdown

Closes#2 (Cannot run on Linux).
Closes#3 ([Feature] Feature Request Support for Macos).

The problem

bin/ contains committed Windows binaries (ffmpeg.exe, ffprobe.exe), and those files are present after a clone on every platform. bin_path("ffmpeg", "ffmpeg.exe") therefore resolved successfully on Linux and macOS and handed a PE image to subprocess, which fails at exec time. A few other Windows-only code paths raised before the editor could open.

This PR removes those blockers so python ui/gui.py runs from source on Linux and macOS using system FFmpeg and libmpv. Windows behaviour is unchanged — bundled binaries still win, so packaged builds stay self-contained.

Changes

Path resolution (app/runtime_paths.py)

  • New tool_path() / ffmpeg_path() / ffprobe_path(). Bundled copy first; off-Windows the .exe spelling is rejected outright and the tool comes from PATH, degrading to the bare name so subprocess raises a readable "not found" instead of us passing a path that does not exist.
  • bin_path() strips a trailing .exe off-Windows, so existing call sites keep working.
  • Every FFmpeg/FFprobe lookup across app/ and ui/ now goes through the helpers instead of hardcoding .exe.

libmpv (ui/utils/media_backend.py, ui/worker_adapters/processing_workers.py)

  • prepare_mpv_bundle() no longer raises FileNotFoundError when bin/mpv is absent. Windows keeps pre-loading the bundled DLL; Linux/macOS defer to the system libmpv that python-mpv already discovers, and a bundled .so/.dylib is added to the loader path if one exists.
  • The startup asset check reports "using the system installation" rather than failing on a missing libmpv-2.dll.

Windows-only API calls

  • os.startfile does not exist off-Windows and raised AttributeError on the four "open folder" actions. They now share open_path_externally(), which falls back to QDesktopServices — the same guard launcher.py already used.
  • Subtitle rendering searches the platform font directories instead of only %WINDIR%\Fonts.

Dependencies (requirements-base.txt)

  • onnxruntime-gpu has no macOS wheel and no non-x86_64 wheel on PyPI, so pip install -r requirements-local.txt failed outright on macOS before anything else could be tried. Environment markers now select the CPU onnxruntime there.

Docs — README and docs/requirements.md gained the Linux/macOS prerequisites and a venv activation note.

Verification

  • Windows resolution is byte-identical before and after (bundled ffmpeg.exe/ffprobe.exe still selected; bin_path() unchanged).
  • A simulated POSIX host rejects the bundled .exe, resolves from PATH, prefers an extension-less bundled binary when present, and finds libmpv.2.dylib.
  • The onnxruntime markers were evaluated across win-x64 / linux-x64 / linux-arm / mac-arm / mac-x64 — exactly one package installs on each.
  • compileall clean; pyflakes reports no new findings versus main.

Scope and caveats

I do not have a Linux or macOS machine, so I could not do a full end-to-end run there — please treat the runtime side as needing a smoke test from someone who can reproduce the original reports. Explicitly out of scope: the packaged .exe build, the CUDA runtime pack, and GPU mode on macOS all remain Windows/NVIDIA-only. This PR targets "runs from source", not "ships a Linux/macOS release".

Fixesnotepower2k1#2 and notepower2k1#3.
The repository ships Windows binaries in `bin/` (`ffmpeg.exe`, `ffprobe.exe`)
and those files are present after a clone on every platform. Linux and macOS
therefore resolved a PE image as the FFmpeg path and failed at exec time, and
several other Windows-only code paths raised before the editor could open.
Path resolution
- `runtime_paths` gains `tool_path()` / `ffmpeg_path()` / `ffprobe_path()`.
Bundled copies still win so packaged Windows builds stay self-contained;
elsewhere the `.exe` spelling is rejected outright and the tool is taken
from PATH, falling back to the bare name for a readable "not found" error.
- `bin_path()` strips a trailing `.exe` off-Windows, so the existing call
sites keep working. Windows resolution is unchanged.
- All FFmpeg/FFprobe lookups across app/ and ui/ now go through the helpers
instead of hardcoding `.exe`.
libmpv
- `prepare_mpv_bundle()` no longer raises when `bin/mpv` is absent. Windows
keeps pre-loading the bundled DLL; Linux/macOS defer to the system libmpv
that python-mpv already discovers, and a bundled `.so`/`.dylib` is added to
the loader path when one is present.
- The startup asset check reports the system installation instead of failing
on a missing `libmpv-2.dll`.
Other Windows-only calls
- `os.startfile` is Windows-only and raised AttributeError on the four
"open folder" actions. They now share `open_path_externally()`, which uses
QDesktopServices elsewhere — the guard the launcher already used.
- Subtitle rendering looks in the platform font directories rather than only
`%WINDIR%\Fonts`.
Dependencies and docs
- `onnxruntime-gpu` has no macOS wheel and no non-x86_64 wheel, so
`pip install -r requirements-local.txt` failed outright on macOS. Markers
now select the CPU `onnxruntime` there; exactly one is installed per
platform.
- README and docs/requirements.md cover the Linux/macOS prerequisites.
Verified: Windows resolution is byte-identical before and after; a simulated
POSIX host rejects the bundled `.exe` and resolves from PATH; pyflakes reports
no new findings. The packaged release build and CUDA pack remain Windows-only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Feature Request Support for Macos Cannot run on Linux

1 participant

@TinNK3