I’ve built Slicer and then SlicerRT from source several times in the past. I followed the online instructions.
In the same computer, I recently updated (via git pull) the Slicer and SlicerRT repositories to master, and then rebuilt from scratch.
The build of Slicer works fine, and I can start Slicer-build/Slicer without problems. The GUI shows perfectly fine, both directly within the computer as well as via ssh -X.
If I call directly /home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/bin/SlicerApp-real that works fine, too.
The build of SlicerRt works fine, however, when I now start inner-build/SlicerWithSlicerRT, (no difference if locally or via ssh -X), I get the following error:
Note that GLX works fine, glxinfo and glxgears show the right output.
Could you let me know what can I do to debug this issue? Is there a way to get more verbose erro information? Some logfile to check? Any idea why this is happening?
If I run /home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/bin/./SlicerApp-real --additional-module-paths /opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-scripted-modules /opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-loadable-modules /opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/cli-modules --no-splash --verbose-module-discovery
the GUI pops up, but with some warnings:
File "<string>", line 5, in <module>
File "<string>", line 5, in <module>
ModuleNotFoundError: No module named 'ctk'
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'getSlicerRCFileName' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'slicer'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'slicer'
qSlicerScriptedLoadableModuleFactory - Failed to import module "NA" python extensions
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/lib/Slicer-5.9/qt-scripted-modules/AddManyMarkupsFiducialTest.py", line 3, in <module>
import ctk
....
Loading module "ExternalBeamPlanning"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-scripted-modules/DoseEngines/__init__.py", line 1, in <module>
from .AbstractScriptedDoseEngine import *
File "/opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-scripted-modules/DoseEngines/AbstractScriptedDoseEngine.py", line 2, in <module>
import vtk, qt, ctk, slicer, logging
ModuleNotFoundError: No module named 'vtk'
....
and DICOM import and many other things are not working.
SlicerRT currently has known build errors with latest Slicer main. See SlicerPreview - Build Errors. So you may actually want to try latest Slicer Stable 5.8.1 if you are trying to find a configuration that can build SlicerRT successfully. See SlicerStable.
I’m having that on Arch Linux too, plus other encoding error messages; I’m using this brute force hack:
diff --git a/Base/Python/slicer/__init__.py b/Base/Python/slicer/__init__.py
index 1443f9b7f8..fbcb831339 100644
--- a/Base/Python/slicer/__init__.py
+++ b/Base/Python/slicer/__init__.py
@@ -183,6 +183,11 @@ except ImportError as detail:
import os
import sys
+import locale
+
+# 'ANSI_X3.4-1968' codec is being enforced since july 2025.
+# Dumb but needed. Don't use getlocale(). A literal is good also.
+locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())
standalone_python = "python" in str.lower(os.path.split(sys.executable)[-1])
If you don’t want to patch the Slicer source tree, you may update __init__.py in your installed tree:
With this hack, Slicer starts but files are badly read (NRRD, DICOM…).
This fix yields a functional Slicer:
locale.setlocale(locale.LC_ALL, "C.UTF-8")
NOTE: this is just a temporary hack for my Linux build at the moment. It should not be needed at all and things should bet back to normal when the library/toolkit/infrastructure upgrade phase is over.