OneTrainer icon indicating copy to clipboard operation
OneTrainer copied to clipboard

[Bug]: Cannot start GUI on Linux Mint / pixi install

Open Doc-Acula opened this issue 4 months ago • 9 comments

What happened?

I am using Linux Mint Kernel: 7.0.0-28-generic Linux Mint 22.3 - Cinnamon 64-bit Cinnamon 6.6.7

I used these steps to install OT: git clone https://github.com/Nerogar/OneTrainer/ -b preview change into the directory ./install.sh

it finished with this message:

[OneTrainer] + pixi install --locked -e cuda13
✔ The cuda13 environment has been installed.

Then I ran ./start-ui.sh which gave this error:

[OneTrainer] + pixi run --locked -e cuda13 python scripts/train_ui.py
Modular Diffusers is currently an experimental feature under active development. The API is subject to breaking changes in future releases.
./lib.include.sh: line 130: 50376 Segmentation fault      (core dumped) "$@"

What did you expect would happen?

No response

Relevant log output


Generate and upload debug_report.log

No response

Doc-Acula avatar Jul 18 '26 11:07 Doc-Acula

Same issue on Linux Mint 22.2, Kernel 6.14.0-37-generic. Fresh install from preview branch, installed with ./install.sh.

./start-ui.sh 
[OneTrainer] + pixi run --locked -e cuda13 python scripts/train_ui.py
Modular Diffusers is currently an experimental feature under active development. The API is subject to breaking changes in future releases.
./lib.include.sh: line 130: 75787 Segmentation fault      (core dumped) "$@"

BobJohnson24 avatar Jul 18 '26 11:07 BobJohnson24

@Doc-Acula @BobJohnson24 Please run PYTHONFAULTHANDLER=1 ./start-ui.sh, and you will probably drop into a debugging shell. Run this command there:

import faulthandler; faulthandler.dump_traceback(file="tracebacks.txt", all_threads=True)

And pass me the tracebacks.txt file that's created.

hameerabbasi avatar Jul 18 '26 15:07 hameerabbasi

@Doc-Acula @BobJohnson24 Please run PYTHONFAULTHANDLER=1 ./start-ui.sh, and you will probably drop into a debugging shell. Run this command there:

import faulthandler; faulthandler.dump_traceback(file="tracebacks.txt", all_threads=True)

And pass me the tracebacks.txt file that's created.

I cannot run that command as I segfault before getting to the debugging shell, but at least it prints some more details now.

PYTHONFAULTHANDLER=1 ./start-ui.sh
[OneTrainer] + pixi run --locked -e cuda13 python scripts/train_ui.py
Modular Diffusers is currently an experimental feature under active development. The API is subject to breaking changes in future releases.
Fatal Python error: Segmentation fault

Current thread 0x00007f070e419740 (most recent call first):
  File "/media/il/BigBun/Minty/OneTrainer/modules/util/ui/pyside6_util.py", line 22 in create_application
  File "/media/il/BigBun/Minty/OneTrainer/scripts/train_ui_qt.py", line 16 in main
  File "/media/il/BigBun/Minty/OneTrainer/scripts/train_ui.py", line 6 in <module>

Extension modules: numpy._core._multiarray_umath, numpy.linalg._umath_linalg, torch._C, torch._C._dynamo.autograd_compiler, torch._C._dynamo.eval_frame, torch._C._dynamo.guards, torch._C._dynamo.utils, torch._C._fft, torch._C._linalg, torch._C._nested, torch._C._nn, torch._C._sparse, torch._C._special, cuda.bindings._bindings.cydriver, cuda.bindings.cydriver, cuda.bindings.driver, cuda.bindings._bindings.cyruntime_ptds, cuda.bindings._bindings.cyruntime, cuda.bindings.cyruntime, cuda.bindings.runtime, _brotli, yaml._yaml, backports.zstd._zstd, PIL._imaging, PIL._imagingft, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, charset_normalizer.md, charset_normalizer.cd, requests.packages.charset_normalizer.md, requests.packages.chardet.md, requests.packages.charset_normalizer.cd, requests.packages.chardet.cd, markupsafe._speedups, sentencepiece._sentencepiece, regex._regex, google._upb._message, av._core, av.logging, av.bytesource, av.buffer, av.audio.format, av.error, av.dictionary, av.container.pyio, av.option, av.descriptor, av.format, av.utils, av.stream, av.container.streams, av.sidedata.encparams, av.sidedata.motionvectors, av.sidedata.sidedata, av.opaque, av.packet, av.container.input, av.container.output, av.container.core, av.codec.context, av.video.format, av.video.reformatter, av.plane, av.video.plane, av.video.frame, av.video.stream, av.codec.hwaccel, av.codec.codec, av.frame, av.audio.layout, av.audio.plane, av.audio.frame, av.audio.stream, av.filter.link, av.filter.context, av.filter.graph, av.filter.filter, av.filter.loudnorm, av.audio.resampler, av.audio.codeccontext, av.audio.fifo, av.bitstream, av.video.codeccontext, scipy._lib._ccallback_c, scipy.sparse._sparsetools, _csparsetools, scipy.sparse._csparsetools, scipy.linalg._fblas, scipy.linalg._flapack, scipy.linalg.cython_lapack, scipy.linalg._cythonized_array_utils, scipy.linalg._solve_toeplitz, scipy.linalg._decomp_lu_cython, scipy.linalg._matfuncs_sqrtm_triu, scipy.linalg._matfuncs_expm, scipy.linalg._linalg_pythran, scipy.linalg.cython_blas, scipy.linalg._decomp_update, scipy.sparse.linalg._dsolve._superlu, scipy.sparse.linalg._eigen.arpack._arpack, scipy.sparse.linalg._propack._spropack, scipy.sparse.linalg._propack._dpropack, scipy.sparse.linalg._propack._cpropack, scipy.sparse.linalg._propack._zpropack, scipy.sparse.csgraph._tools, scipy.sparse.csgraph._shortest_path, scipy.sparse.csgraph._traversal, scipy.sparse.csgraph._min_spanning_tree, scipy.sparse.csgraph._flow, scipy.sparse.csgraph._matching, scipy.sparse.csgraph._reordering, scipy.spatial._ckdtree, scipy._lib.messagestream, scipy.spatial._qhull, scipy.spatial._voronoi, scipy.spatial._distance_wrap, scipy.spatial._hausdorff, scipy.special._ufuncs_cxx, scipy.special._ufuncs, scipy.special._specfun, scipy.special._comb, scipy.special._ellip_harm_2, scipy.spatial.transform._rotation, scipy.optimize._group_columns, scipy.optimize._trlib._trlib, scipy.optimize._lbfgsb, _moduleTNC, scipy.optimize._moduleTNC, scipy.optimize._cobyla, scipy.optimize._slsqp, scipy.optimize._minpack, scipy.optimize._lsq.givens_elimination, scipy.optimize._zeros, scipy.optimize._cython_nnls, scipy._lib._uarray._uarray, scipy.linalg._decomp_interpolative, scipy.optimize._bglu_dense, scipy.optimize._lsap, scipy.optimize._direct, scipy.integrate._odepack, scipy.integrate._quadpack, scipy.integrate._vode, scipy.integrate._dop, scipy.integrate._lsoda, scipy.interpolate._fitpack, scipy.interpolate._dfitpack, scipy.interpolate._dierckx, scipy.interpolate._ppoly, scipy.interpolate._interpnd, scipy.interpolate._rbfinterp_pythran, scipy.interpolate._rgi_cython, scipy.interpolate._bspl, scipy.special.cython_special, scipy.stats._stats, scipy.stats._sobol, scipy.stats._qmc_cy, scipy.stats._biasedurn, scipy.stats._stats_pythran, scipy.stats._levy_stable.levyst, scipy.stats._ansari_swilk_statistics, scipy.stats._mvn, scipy.stats._rcont.rcont, scipy.ndimage._nd_image, scipy.ndimage._rank_filter_1d, _ni_label, scipy.ndimage._ni_label, psutil._psutil_linux, psutil._psutil_posix, pywt._extensions._dwt, pywt._extensions._cwt, pywt._extensions._pywt, pywt._extensions._swt, shiboken6.Shiboken, PySide6.QtCore, PySide6.QtGui, PySide6.QtWidgets, kiwisolver._cext, _cffi_backend (total: 185)
./lib.include.sh: line 130: 11671 Segmentation fault      (core dumped) "$@"

BobJohnson24 avatar Jul 18 '26 16:07 BobJohnson24

Please try on the main branch, not on preview, because this type of issue is either related

  • what packages are instaled - and the preview branch contains a new package manager, pixi
  • what packages / libraries are installed on the system itself

You could also try the repro code by Claude below


TL;DR: The segfault is inside Qt's platform-plugin init (QApplication(sys.argv)), not in any OneTrainer code — Python never even gets to build a widget. On Linux this is almost always the Qt platform plugin (Wayland or xcb) crashing during connection to your display server.

What's happening

The whole Python traceback is:

  pyside6_util.py:22  → app = QApplication(sys.argv)
  train_ui_qt.py:16   → create_application()
  train_ui.py:6       → main()

QApplication(sys.argv) is the first Qt call. It loads a platform plugin (libqwayland*.so or libqxcb.so from the pip PySide6 wheel) and connects to the compositor. A hard segfault here — rather than Qt's usual "could not load the Qt platform plugin" message — is a native crash in that plugin or a system lib it links against. Nothing in the OneTrainer Qt code (the recent combo-box / palette changes) is reached yet.

Please run these on your machine so we can pin it down. Run them there (or paste with the ! prefix if you're in this session):

Which session type / compositor: echo "$XDG_SESSION_TYPE $WAYLAND_DISPLAY $DISPLAY"

Force X11/XWayland instead of the native Wayland plugin — this fixes the large majority of these crashes, since the pip PySide6 Wayland plugin segfaults on many setups:

QT_QPA_PLATFORM=xcb ./start-ui.sh

If that still crashes, get the plugin-load trace:

QT_DEBUG_PLUGINS=1 ./start-ui.sh 2>&1 | tail -40

The last few lines before the segfault will name the exact .so that failed and any missing symbol/library.

Likely outcomes

  • QT_QPA_PLATFORM=xcb works → it's the Wayland plugin. We can make the launcher default to xcb, or you set it in your environment.
  • Still crashes, QT_DEBUG_PLUGINS names a missing lib (e.g. libxcb-cursor0, libxkbcommon-x11) → a missing system package; install it via your distro.

Send me the output of those three and I'll tell you the exact fix. What's your setup — Wayland or X11, and which distro/desktop?

# repro_qt.py — minimal QApplication segfault repro
  import sys
  import os

  print("session:", os.environ.get("XDG_SESSION_TYPE"),
        "| QT_QPA_PLATFORM:", os.environ.get("QT_QPA_PLATFORM"))

  # Toggle this to test whether importing torch first is what triggers the crash.
  IMPORT_TORCH_FIRST = True
  if IMPORT_TORCH_FIRST:
      print("importing torch...", flush=True)
      import torch  # noqa: F401
      print("torch imported", flush=True)

  print("importing PySide6...", flush=True)
  from PySide6.QtWidgets import QApplication
  print("PySide6 imported", flush=True)

  print("creating QApplication...", flush=True)
  app = QApplication(sys.argv)      # <-- crash happens here in the real run
  print("QApplication created OK", flush=True)

How to use it to narrow the cause:

  1. As-is (IMPORT_TORCH_FIRST = True) — mirrors the real startup order. If it segfaults, we've reproduced it in ~15 lines.
  2. Set IMPORT_TORCH_FIRST = False — pure Qt, no torch. - Still crashes → it's purely the Qt platform plugin (torch is innocent). - Now works → torch's shared libs are conflicting with Qt's plugin (a known class of issue: torch pulls in its own libstdc++/libgomp, and the xcb/Wayland plugin then loads against the wrong one).
  3. Force xcb: QT_QPA_PLATFORM=xcb pixi run --locked -e cuda13 python repro_qt.py

The flush=True prints tell you exactly which line dies — you'll see whether it's the import or the QApplication(sys.argv) call.

Want me to also add a variant that prints the loaded libstdc++/libxcb paths (via /proc/self/maps) right before the crash? That pins down a library-version conflict if hypothesis 2 turns out to be the case.

dxqb avatar Jul 18 '26 17:07 dxqb

  1. Claude's reproduction code runs just fine
pixi run --locked -e cuda13 python asd.py 
session: x11 | QT_QPA_PLATFORM: None
importing torch...
torch imported
importing PySide6...
PySide6 imported
creating QApplication...
QApplication created OK
  1. Obviously there is no pixi on main, and I prefer to avoid conda so I will not test that, though the other user had some mysterious issues with the conda install script I believe.

  2. I did however test https://github.com/hameerabbasi/OneTrainer/tree/modernize-install for the vanilla pixi experience, fresh pixi env, and same issue

./install.sh 
[OneTrainer] + pixi install --locked -e cuda13
✔ The cuda13 environment has been installed.
./start-ui.sh 
[OneTrainer] + pixi run --locked -e cuda13 python scripts/train_ui.py
Modular Diffusers is currently an experimental feature under active development. The API is subject to breaking changes in future releases.
./lib.include.sh: line 130: 32201 Segmentation fault      (core dumped) "$@"

BobJohnson24 avatar Jul 18 '26 18:07 BobJohnson24

2. Obviously there is no pixi on main, and I prefer to avoid conda so I will not test that, though the other user had some mysterious issues with the conda install script I believe.

main uses pip. if on your system it chooses conda set OT_PREFER_VENV=true I don't know why it chooses conda sometimes, something obsolete in install.sh

dxqb avatar Jul 18 '26 18:07 dxqb

@Doc-Acula @BobJohnson24 Can you try the newest modernize-install branch? https://github.com/hameerabbasi/OneTrainer/tree/modernize-install

Or from this PR: https://github.com/Nerogar/OneTrainer/pull/1244

hameerabbasi avatar Jul 21 '26 06:07 hameerabbasi

@Doc-Acula @BobJohnson24 Can you try the newest modernize-install branch? https://github.com/hameerabbasi/OneTrainer/tree/modernize-install

Or from this PR: #1244

I had the same problem as the two users above when I tried to make a separate install for the preview branch (OS: Xubuntu 24 LTS). It tested your fix (new install with modernize-install branch) and now the UI will open without segfault.

Silvicultor avatar Jul 25 '26 14:07 Silvicultor

I'd suggest closing this since the issue has been solved both on preview and #1244. Thanks for the report!

hameerabbasi avatar Jul 29 '26 14:07 hameerabbasi