Skip to content

OneTrainer fails to launch on Linux because Stability Matrix forces legacy CustomTkinter UI #1722

Description

@SturmB

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:

# 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

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 CtkTopBarView(
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/modules/ui/CtkTopBarView.py", line 28, in __init__
    self.build(frame, master, controller, ui_state, change_model_type_callback, change_training_method_callback, load_preset_callback)
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/modules/ui/BaseTopBarView.py", line 79, in build
    self.components.options_kv(
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/modules/util/ui/ctk_components.py", line 484, in options_kv
    component = ctk.CTkOptionMenu(master, values=keys, command=update_component)
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/venv/lib/python3.10/site-packages/customtkinter/windows/widgets/ctk_optionmenu.py", line 86, in __init__
    self._dropdown_menu = DropdownMenu(master=self,
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/venv/lib/python3.10/site-packages/customtkinter/windows/widgets/core_widget_classes/dropdown_menu.py", line 44, in __init__
    self._add_menu_commands()
  File "/h-games/stabilitymatrix/Data/Packages/OneTrainer/venv/lib/python3.10/site-packages/customtkinter/windows/widgets/core_widget_classes/dropdown_menu.py", line 91, in _add_menu_commands
    self.delete(0, "end")
  File "/h-games/stabilitymatrix/Data/Assets/Python/cpython-3.10.19-linux-x86_64-gnu/lib/python3.10/tkinter/__init__.py", line 3381, in delete
    num_index1, num_index2 = self.index(index1), self.index(index2)
  File "/h-games/stabilitymatrix/Data/Assets/Python/cpython-3.10.19-linux-x86_64-gnu/lib/python3.10/tkinter/__init__.py", line 3406, in index
    return self.tk.getint(i)
_tkinter.TclError: expected integer but got ""

Environment details:

Stability Matrix: 2.16.2+79b61f555667456e33bccfb25248e4bc3283aaca
OneTrainer: 23df3832e8f213d64c337e39f9365ba46e99fed0
OS: CachyOS Linux (Arch-based rolling release)
Python: 3.10.19 (Stability Matrix embedded runtime)
Tcl/Tk: 9.0.3
CustomTkinter: 5.2.2

Version

v2.16.2

What Operating System are you using?

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions