Latest slicer preview (r33816) does not launch in macos

Tested on two different macs (imac and macbook pro) with Sequoia 15.5. After entering the security exception, Slicer icon continues to bounce for about a minute and then quits. When launched from the terminal window from Slicer.app/Contents/MacOS/Slicer, this is the error message:

% pwd
/Users/murat

% /Users/murat/Desktop/Slicer.app/Contents/MacOS/Slicer
Could not find platform independent libraries 
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘Slicer’
isolated = 0
environment = 1
user site = 0
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = ‘/Users/svc-dashboard/D/P/A/python-install/lib/python3.12’
sys.\_base_executable = ‘/Users/murat/Desktop/Slicer.app/Contents/MacOS/Slicer’
sys.base_prefix = ‘/Users/svc-dashboard/D/P/A/python-install’
sys.base_exec_prefix = ‘/Users/svc-dashboard/D/P/A/python-install’
sys.platlibdir = ‘lib’
sys.executable = ‘/Users/murat/Desktop/Slicer.app/Contents/MacOS/Slicer’
sys.prefix = ‘/Users/svc-dashboard/D/P/A/python-install’
sys.exec_prefix = ‘/Users/svc-dashboard/D/P/A/python-install’
sys.path = \[
‘/Users/svc-dashboard/D/P/A/python-install/lib/python312.zip’,
‘/Users/svc-dashboard/D/P/A/python-install’,
‘/Users/svc-dashboard/D/P/A/python-install/lib-dynload’,
‘/Users/svc-dashboard/D/P/A/python-install/plat-darwin’,
‘/Users/svc-dashboard/D/P/A/python-install/lib/python3.12’,
‘/Users/svc-dashboard/D/P/A/python-install/lib/python3.12/lib-dynload’,
‘/Users/svc-dashboard/D/P/A/python-install/lib-tk’,
‘/Users/svc-dashboard/D/P/A/python-install/lib/python3.12’,
‘/Users/svc-dashboard/D/P/A/python-install/lib/python3.12/lib-dynload’,
\]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’

Current thread 0x0000000200aaf200 (most recent call first):

The same ModuleNotFoundError: No module named 'encodings' happens with Slicer 5.8.1 as you reported over in the other thread?

I can replicate the same failure to launch (same error message) with Slicer Preview 2025-08-01 on a macbook air m3. 5.8.1 starts fine, as does the SlicerDesigner app from the Preview.

I think those are separate and i believe that error arose because i didnt launch the correct SlicerDesigner, but the Designer application, which didnt set the correct python environment as you mentioned in that thread.

This is the proper Slicer launcher that generates the error.

On mac there’s no launcher in the distribution, so this is something with the app packaging or startup process itself.

Does a Slicer preview build from May have the same problem specifically on macOS 15.5? Just wondering if related to changes in macOS security impacting the unsigned Slicer preview builds (Slicer 5.8.1 is a signed version) is a cause here or something in recent Slicer commits.

No this is new. I have been using preview through out july on the same computer

So is this a minor issue that can be fixed fairly quickly or should I open an issue on GH? As of right now, today’s build also not usable.

@jcfr @lassoan

Failure to launch is a serious issue, so submitting an issue on github makes sense; and then this discussion should continue there. Peobably @jcfr knows most about potential root causes and fixes, but maybe you can help the investigation if you determine which is the first date where the Slicer Preview Release started to fail (you can use the offset option on thr download page to get previous releases, for example Download 3D Slicer | 3D Slicer).

1 Like

Will do but there is something weird with the offset parameters. This is what I get when i put in ?offset=-3

Not sure why it is showing random stable versions, which are clearly dated wrong. Also when I click the 5.9.0 from July 30, the downloaded package shows as Slicer-5.9.0-2025-07-25-macosx-amd64.dmg

because it doesn’t launch, I can’t confirm whether it is indeed the revision 33809 or a different revision number.

The last version that I can download and get it to work on my mac is:

5.9.0-2025-07-12 r33764 / d6c7975

To follow-up on this, the root cause has been identified.

Waiting it is addressed, consider running Slicer using the following helper script: slicer-macos-launch.sh


Download the script:

curl -LO https://gist.githubusercontent.com/jcfr/4eca5ab7d5d0da9706ad4099a07c6949/raw/slicer-macos-launch.sh
chmod u+x slicer-macos-launch.sh

Run Slicer:

slicer-macos-launch.sh /path/to/Slicer.app
2 Likes

Et voila. Corresponding fix has just been integrated :rocket:

Thanks @pieper for the review :folded_hands:

And if you curious about the details …


PR-8632 introduces initializeEnvironmentFromLauncher() and ensures it runs before argument parsing and Python interpreter initialization. The method reads launcher .ini settings, discovers Slicer home, and sets environment variables required by early subsystems (e.g Python).

In the context of macOS installer where no launcher is used (only launcher settings file is provided along side the “real” executable), the previous init order could start Python with a partial environment, causing early import failures.

Follow-up to Slicer@fa915a03fc (“BUG: Fix improper Python initialization causing inconsistent interpreter state”) introduced through PR-8582.

1 Like

Confirmed it is working. Thanks everyone who helped fix it.

1 Like