OneTrainer 在 Linux 上无法启动,因为 Stability Matrix 强制使用传统的 CustomTkinter UI

作者: SturmB创建于 2026年8月24日更新于 2026年8月28日

Package: OneTrainer

When did the issue occur?

Running the Package

What GPU/hardware type are you using?

NVIDIA GeForce RTX 4090 with CUDA (driver 610.57.04)

What happened?

On Linux, launching a current OneTrainer checkout from Stability Matrix 2.16.2 exits immediately while constructing the legacy CustomTkinter UI. Stability Matrix currently hardcodes scripts/train_ui_ctk.py in OneTrainer.cs. Current OneTrainer has restored scripts/train_ui.py as a compatibility shim that launches the new Qt UI, while train_ui_ctk.py is the legacy UI. The Stability Matrix embedded Python 3.10.19 runtime reports Tcl/Tk 9.0.3. OneTrainer installs CustomTkinter 5.2.2. Creating the first CTkOptionMenu calls Menu.delete(0, "end"); with Tk 9 the empty menu index is returned as an empty string, causing tkinter.Menu.index() to raise _tkinter.TclError: expected integer but got "".

Steps to reproduce

  1. Install or update OneTrainer through Stability Matrix 2.16.2 on Linux.
  2. Use OneTrainer commit 23df3832e8f213d64c337e39f9365ba46e99fed0 (current master when reproduced).
  3. Open Packages → OneTrainer.
  4. Press Launch.

Expected behavior

Stability Matrix launches OneTrainer's current supported/default Qt training UI.

Actual behavior

Stability Matrix launches scripts/train_ui_ctk.py, which crashes before a window opens.

Confirmed workaround

Changing the Stability Matrix-targeted entry point to delegate to train_ui_qt.main makes the exact formerly failing launch command open a mapped OneTrainer window successfully. A durable package-side fix would be to launch scripts/train_ui.py when it exists. That file is explicitly maintained by OneTrainer as the compatibility shim for external launchers and currently delegates to Qt. If compatibility with the transitional revisions where that file was absent is required, scripts/train_ui_ctk.py could be used only as a fallback when scripts/train_ui.py does not exist. Relevant current OneTrainer file:

python
# Kept for backwards compatibility with external launchers (e.g. Stability
# Matrix) that invoke this file directly instead of start-ui.bat/.sh.
from train_ui_qt import main
### Console output
```text
nvCOMP: low-level batched-ANS backend loaded
Modular Diffusers is currently an experimental feature under active development. The API is subject to breaking changes in future releases.
Traceback (most recent call last):
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/scripts/train_ui_ctk.py", line 14, in <module>
    main()
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/scripts/train_ui_ctk.py", line 9, in main
    ui = CtkTrainUIView()
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/modules/ui/CtkTrainUIView.py", line 119, in __init__
    self.top_bar_component = self.top_bar(self)
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/modules/ui/CtkTrainUIView.py", line 218, in top_bar
    return

内容来源: LykosAI/StabilityMatrix