Installation Instructions

FSL-MRS should be installed via the main FSL installer (Option 1) or using the conda package manager (Option 2). Building from source code is possible using the instructions in Option 3. For installation on MS Windows machines please see the specific setup instructions below

Option 1: FSL install script

The primary installation method is via the FSL installer. Follow the instructions on the main FSL wiki installation page. If the fsl_mrs version is not the latest, then run update_fsl_package fsl_mrs to update it.

Option 2: Using Conda

The alternative installation method is via conda. After installing conda and creating or activating a suitable environment you can install FSL-MRS from the FSL conda channel. See our page on setting up a conda enviroment for a step by step guide. Do not install FSL-MRS into the base environment (this is the environment that starts activated).

conda install -c conda-forge \
              -c https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/ \
              fsl_mrs

Set FSLDIR and FSLOUTPUTTYPE environment variables within your activated environment - Do not set them in the base environment!

export FSLDIR="${CONDA_PREFIX}"
export FSLOUTPUTTYPE="NIFTI_GZ"

To check the version installed run fsl_mrs --version. FSL-MRS can be updated by running conda update:

conda update -c conda-forge \
              -c https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/ \
              fsl_mrs

Example data with conda

Installation with conda is easy, but you won’t get the packaged example data and notebooks. This can be downloaded separately here: FSL-MRS example data.

Option 3: From GitLab

Download or clone from FSL-MRS GitLab. To get FSL-MRS with example data and example Jupyter notebooks, download the full package from gitlab. Git LFS must be installed to download package data.

git clone --recurse-submodules https://git.fmrib.ox.ac.uk/fsl/fsl_mrs.git
cd fsl_mrs
conda install -c conda-forge -c defaults \
        -c https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/ \
        --file requirements.txt
pip install --no-deps .

To access all features (those which rely on other FSL tools, e.g. the svs_segment scripts), you should either install FSL or run the following commands within your conda environment:

conda install -c https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/ -c conda-forge fsl-flirt fsl-flameo fsl-avwutils fsl-fugue
export FSLDIR="${CONDA_PREFIX}"
export FSLOUTPUTTYPE="NIFTI_GZ"

Note: You may need to run re-activate your conda environment to access the CLI tools.

Windows Operating System

FSL-MRS has been tested thoroughly on Mac and Linux operating systems, but it is limited tested on MS Windows. However there are three routes for using FSL-MRS on Windows.

Option B: Native windows FSL-MRS + FSL on WSL

Alternatively, as of V1.1.13 of FSL-MRS the Python-only FSL-MRS package can be run in native Windows alongside a WSL FSL installation. This can be achieved as follows:

  1. Enable WSL and install FSL into WSL as described in the FSL install instructions.

  2. Add an FSLDIR environment variable on the host Windows machine. This should be set to \\wsl$<Distro>home<wsl-user>fsl, where <Distro> is the Linux distribution installed in WSL, and <wsl-user> is the WSL user account that you created when you set up WSL. a. In PowerShell this can be done for a single session with the command $env:FSLDIR = "\\wsl$<Distro>home<wsl-user>fsl". b. In Command Prompt this can be done for a single session with the command set FSLDIR="\\wsl$<Distro>home<wsl-user>fsl". c. To set it permanently, in either shell run the command setx FSLDIR "\\wsl$<Distro>home<wsl-user>fsl". Restart your terminal window for the variable to be accessible.

  3. Install FSL-MRS on the native Windows machine by following the conda installation guide in Option 2.

Note: You may need to run FSL-MRS in a terminal with administrator rights as certain functions (e.g. symlink) might not have the required privileges to execute correctly.

Option C: Native windows FSL-MRS (partial function)

Install FSL-MRS on the native Windows machine by following the conda installation guide in Option 2. Certain features which rely on an FSL installation (e.g. the svs_segment scripts) won’t function.

Note: You may need to run FSL-MRS in a terminal with administrator rights as certain functions (e.g. symlink) might not have the required privileges to execute correctly.

Verifying the installation

Please run the packaged fsl_mrs_verify script to confirm that installation has successfully completed.