<> = Introduction = We recommend using Linux or macOS for using FSL. However FSL can be used on Windows via the Windows Subsystem for Linux (WSL, Windows 10 and newer, recommended option) or by running the Linux version of FSL inside a virtual machine (VM). = Windows Subsystem for Linux = This is the recommended option for using FSL on a Windows computer. We have created an [[https://www.youtube.com/watch?v=QNp3lyP57rw|installation video]] which gives an overview of the installation procedure for the Windows Subsystem for Linux using Windows 10. == System Requirements == * Windows 10 or newer. You need to have Windows 10 version 2004 (Build 19041) or higher. You can find out your Windows version / build by opening the '''Settings''' app, and navigating to ''System'' > ''About''. * The Windows Subsystem for Linux (WSL) can be installed by following [[https://docs.microsoft.com/en-us/windows/wsl/install|these instructions]]. If you are using an older version of Windows and cannot upgrade, refer to [[https://docs.microsoft.com/en-us/windows/wsl/install-manual|this page]] for installation instructions. * Dual core CPU (recommended minmum) * 4GB RAM minimum (8GB+ recommended) * Minimum 10GB, up to 75GB, of free disk space '''Follow these steps to install Ubuntu into the Windows Subsystem for Linux:''' 1. Enable WSL by opening !PowerShell as administrator. Paste this command in and press enter. Follow any prompts given. . {{{ wsl --install -d Ubuntu-20.04 }}} 2. Restart your computer 3. Start the "Ubuntu" app to open an Ubuntu shell. 4. Set up a username and password for Ubuntu (only necessary the first time you launch it) '''Now follow these steps to install FSL into your Ubuntu machine:''' 1. Copy+paste these commands into the Ubuntu shell to install a few FSL dependencies: {{{ sudo apt update sudo apt -y upgrade sudo apt install bc dc python3 mesa-utils gedit pulseaudio libquadmath0 libgtk2.0-0 firefox libgomp1 }}} 2. On Windows 10, you need to install a separate application in order to use the FSL user interfaces. We currently recommend installing [[https://sourceforge.net/projects/vcxsrv/files/latest/download|VcXsrv]] - this will install an application called XLaunch. When running XLaunch, it is '''critical''' to deselect `Native OpenGL` and select `Disable access control` in the `Extra Settings` panel. You need to start the XLaunch app in order for graphical applications in Ubuntu to work. 3. In order for !VcXsrv to work, you will need to add these lines to your `.bashrc` file. Copy+paste the following lines into the Ubuntu shell: {{{ echo "export DISPLAY=\$(grep nameserver /etc/resolv.conf | awk '{print \$2; exit}'):0" >> ~/.bashrc echo "export LIBGL_ALWAYS_INDIRECT=0" >> ~/.bashrc }}} For Windows 11 you will also need to add run an additional command: {{{ echo "export LIBGL_ALWAYS_SOFTWARE=1" >> ~/.bashrc }}} 4. Try running `glxgears`. A window with three spinning gears should open. If this doesn't work, it is possible that Windows Defender Firewall has blocked the !VcXsrv process. Go to '''Control panel''' > '''System and security''' > '''Windows defender firewall''' > '''Advanced settings''' > '''Inbound rules''' and make sure that the !VcXsrv rules are '''not''' set to ''block'' - if they are you will need to edit the !VcXsrv rule and change it from ''block'' to ''allow''. {{{#!wiki caution If the rule is missing then the process to add a new rule is: Windows Defender —> Advanced Settings —> Inbound Rules ( left panel ) —> New Rule ( right panel ) —> Program —> This Program Path (`C:\Program Files\VcXsrv\xlaunch.exe`) —> Next x3 —> Finish ( pick a name like “xlaunch” or “VcXsrv" ) }}} 5. Use any web browser installed on your Windows computer to get the `fslinstaller.py` script from [[http://fsl.fmrib.ox.ac.uk/fsldownloads|here]]. Download it to your `Downloads` folder. When selecting the OS to install on the download page, it is important to choose Ubuntu (the Linux version installed by WSL) and ''not'' Windows, or you will be directed to the VM instead of the installer script. 6. Run the `fslinstaller.py` script in the Ubuntu shell with this command. Replace `` with your Windows account username: {{{ python "/mnt/c/Users//Downloads/fslinstaller.py" }}} Say yes to all default install options. The installation can take some time, so please be patient, and do not abort the installation. {{{#!wiki caution FSL must be installed into the WSL file system - do not try and install FSL into a location in your Windows file system. The safest option is to accept the default location, which is ```/usr/local/fsl/```. }}} 7. Close and re-open the Ubuntu shell. 8. Try running the `fslmaths`, `fsl`, and `fsleyes` commands. == Accessing USB drives from Ubuntu == If you want to mount other folders or drives (e.g USB drives), create a directory in your Ubuntu file system where the drive will be mounted - replace `` with a name of your choosing: {{{ sudo mkdir /mnt/ }}} Now mount the USB drive with this command, replacing `` with the letter that the USB drive appears as in Windows: {{{ sudo mount -t drvfs /mnt/ }}} For example, if your USB drive appears as drive E, you would run this: {{{ sudo mount -t drvfs E: /mnt/ }}} This mount command will need to be rerun each time you start a new WSL session. == WSL 1 == We strongly recommend using WSL 2 over WSL 1. If you have WSL 1, you can update to WSL 2 by opening !PowerShell as administrator, and running these commands: {{{ wsl --set-default-version 2 wsl --set-version Ubuntu-20.04 2 }}} If for some reason you are unable to upgrade to WSL 2, you may need to install Xming instead of !VcXsrv. You can download Xming from [[https://sourceforge.net/projects/xming/files/Xming/6.9.0.31/Xming-6-9-0-31-setup.exe/download|here]]. You will need to have Xming running in windows, before any linux GUIs will work. If you decide to use Xming, you will need to run this command to add an extra line to your `.bashrc` file: {{{ echo "export DISPLAY=localhost:0.0" >> ~/.bashrc }}} = Virtual Machine = If you are unable to use the Windows Subsystem for Linux (WSL) as outlined above, another option for using FSL on a Windows computer is to use a virtual machine (VM). You can use the freely available [[https://www.virtualbox.org/|VirtualBox]], or [[https://www.vmware.com/uk/products/workstation-pro.html|VMWare Workstation]] if you have a licence. There are many online tutorials which describe how to install and set up a virtual machine, e.g.: * https://www.howtogeek.com/796988/how-to-install-linux-in-virtualbox/ * https://www.arcserve.com/blog/dead-simple-guide-installing-linux-virtual-machine-windows FSL can be installed into most modern Linux distributions - we recommend an Ubuntu LTS release, such as 20.04 or 22.04. Once you have installed a Linux VM, you can install FSL in the same way as for other platforms. 1. Use a web browser '''inside the VM''' to download the `fslinstaller.py` script from [[http://fsl.fmrib.ox.ac.uk/fsldownloads|here]]. 2. Open a terminal inside the VM, and run: {{{ cd ~/Downloads python fslinstaller.py }}} {{{#!wiki note Some systems do not have a command called `python`, and will print errors like `python: command not found`. If this happens try calling `python3 fslinstaller.py` or `python2 fslinstaller.py`. }}}