05 SWANe on Windows - LICE-dev/swane GitHub Wiki
SWANe can't run on Windows due to the fact some mandatory (such as FSL) and optional but recommended dependencies (such as FreeSurfer) does not have a compatible version with the Microsoft OS.
However, starting from Windows 10 (Build 19041), it is possible to use the Windows Subsystem for Linux (WSL) feature to run a Linux environment without the need for a separate virtual machine or dual booting.
This guide will attempt to describe the basic steps to set up the WSL environment and run SWANe properly.
Note
Installing a Linux Distro via WSL is quite simple. However, its configuration can be a bit tricky due the fact a large number of packages and dependencies usually pre-installed in a standard Linux Distro are missing and need to be installed manually.
Important
Keep in mind that, although WSL is a powerful and well-optimized tool and it is theoretically lighter in terms of resources used compared to a virtual machine, it is still a subsystem, and therefore less performing compared to a standalone Ubuntu.
This inevitably leads to a slowdown of SWANe and to an increment of memory and RAM usage by the analyses, which some less performing PCs could not handle.
To install and use a Linux Environment, read the official guide.
Tip
WSL exists in two versions.
We recommend you to use WSL2, which ensures better performance.
Tip
As described in the Getting Started section, SWANe is developed and optimized for Ubuntu > 20.XX.
For this reason we recommend you to install one of the suggested Ubuntu Distros on the WSL environment.
After the installation, the Linux Environment can be reached via the Windows File Manager.

The environment terminal can be found in the Windows Start menu.

To ease the Linux Environment setup, we suggest that you update both WSL and system package tool, respectively, from the Windows PowerShell and the Linux terminal.
wsl --update
sudo apt update
After the base configuration of the WSL Environment, SWANe can be installed and launched following the Ubuntu Installation instructions from the Getting Started section.
As said in a previous warning, the Linux Distro installed via WSL lacks many libraries and dependencies usually pre-installed in a standard Distro.
libGL is one of them, and it's mandatory for the execution of OpenGL-based programs.
To install it on the WSL Environment, execute the following command in the terminal:
sudo apt -y install python3-pyqt5
libGL is a reverse-polish desk calculator, a mandatory dependency for FSL.
Such as libGL, it must probably be installed manually in a WSL Environment.
To install it, execute the following command in the terminal:
sudo apt install dc
This error could occur in case the WSL version used to install the Linux Environment is pre-2021.
To solve the issue, update WSL as described at the end of the Linux Installation via Windows WSL paragraph.
The use of 3D Slicer Extension Manager for the installation of SlicerFreeSurfer could fail due to the fact the 3D Slicer folder is missing the reading/writing permissions.
To solve this issue, execute the following command in the terminal:
sudo chmod 755 PATH/TO/SLICER_FOLDER
WSL could return the following error at the 3D Slicer start:
X Error: BadAccess (attempt to access private resource denied) 10
Extension: 130 (MIT-SHM)
Minor opcode: 1 (X_ShmAttach)
Resource id: 0xfe
X Error: BadShmSeg (invalid shared segment parameter) 128
Extension: 130 (MIT-SHM)
Minor opcode: 3 (X_ShmPutImage)
Resource id: 0x600009
This issue is caused by a partial incompatibility between WSL and X11. To solve this issue, you can disable the unsupported X11 feature creating or inserting the following environmental variable in your profile.
export QT_X11_NO_MITSHM=1
3D Slicer Extension Manager is a module based on Chromium (QtWebEngine) that should be executed without root permissions. Opening 3D Slicer Extension Manager under root permissions could cause the software crash and the following error:
An OpenGL Core Profile was requested, but it is not supported on the current platform. Falling back to a non-Core profile. Note that this might cause rendering issues.
[10625:10625:0211/162005.662866:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
To solve the issue you can:
- Execute 3D Slicer under the --no-sandbox flag:
./Slicer --no-sandbox
- Create or insert the following environmental variable in your profile.
export QTWEBENGINE_DISABLE_SANDBOX=1