Skip to content

Instantly share code, notes, and snippets.

@lkoelman
Last active August 4, 2019 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkoelman/2257b3522662055466dc724bc3a1ede6 to your computer and use it in GitHub Desktop.
Save lkoelman/2257b3522662055466dc724bc3a1ede6 to your computer and use it in GitHub Desktop.
Install FSL on Fedora Linux

Download the FSL installer (python script) from https://fsl.fmrib.ox.ac.uk/fsldownloads_registration.

Type following commands in a Python interpreter:

from fslinstaller import *
manifest = get_web_manifest(Settings.mirror)
import json
with open('~/manifest.json', 'w') as fp:
  json.dump(manifest, fp)

Open the manifest.json file and look for the filenamename of the latest CentOS FSL version (ending in .tar.gz).

Append this filename to the string in Settings.mirror and paste into your browser: this downloads the required binaries.

# Install dependencies
sudo yum install expat-devel libmng libpng12

# Extract FSL binaries into desired folder (I chose `~/.local`)
cd ~/.local
tar -xzf ~/Downloads/fsl-<fsl_version)-<centos_version>.tar.gz
FSLDIR=`pwd`/fsl
. fsl/etc/fslconf/post_install.sh -f $FSLDIR

Add folowing lines to .bashrc:

FSLDIR=$HOME/.local/fsl
PATH=${FSLDIR}/bin:${PATH}
export FSLDIR PATH
. ${FSLDIR}/etc/fslconf/fsl.sh
@msp-trc
Copy link

msp-trc commented Jul 8, 2019

Hi, I'm on Fedora 29 attempting to install FSL6.0.1 for Centos7 and when attempting to use the above in a python2 (2.7.15) interpreter, I get

with open('~/manifest.json, 'w') as fp: File "<stdin>", line 1 with open('~/manifest.json, 'w') as fp:
^
SyntaxError: invalid syntax

I assume this is an issue related to which version of python we're running. Could you kindly recommend a fix?

@lkoelman
Copy link
Author

lkoelman commented Jul 8, 2019

Hi there, it looks like I had a typo in that python snippet where the closing quotation mark around manifest.json was a backtick. Can you try replacing that? I updated it in the gist. Can't test unfortunately at the moment.

Cheers,
Lucas.

@msp-trc
Copy link

msp-trc commented Jul 8, 2019

Hi Lucas,

Thanks for getting back. Apologies, we now have this problem:

with open('~/manifest.json', 'w') as fp:
... json.dump(manifest, fp)
File "", line 2
json.dump(manifest, fp)
^
IndentationError: expected an indented block

Please forgive my limited knowledge of Linux: am I supposed to tab-over the json.dump? If I enter this, I see another ellipsis. Am I thereafter supposed to use open(manifest.json,rw) in the interpreter?

Big thanks in advance. - Matt

@lkoelman
Copy link
Author

lkoelman commented Jul 8, 2019

Hi, try using either two or four spaces before the json.dump(...) line. I don't know how many spaces are considered as one indent level in the default python interpreter. Should be pretty flexible as long as there is at least one space.

@msp-trc
Copy link

msp-trc commented Jul 9, 2019

Hi Lucas,

Again, my apologies, but when I use two spaces, four, or a tab before json.dump(manifest, fp) and hit enter, the command line only returns ". . ." Is this correct?

Thanks again for all the help.

@lkoelman
Copy link
Author

This is normal, just press enter again. When you enter indented multi-line input, you have to finish with an empty line. I suggest playing around a bit in the Python interpreter to get familiar with it.

@msp-trc
Copy link

msp-trc commented Jul 18, 2019

Hi Lucas,

Hope you're doing well. May I ask you another question? In going back through the interpreter, the following is being reported:

os.getcwd()
'/home/Little.MRI.Lab/Downloads'
dirlist = os.listdir("/home/Little.MRI.Lab/Downloads")
dirlist
['fslinstaller.py', 'matlab_R2019a_glnxa64', 'matlab_R2019a_glnxa64.zip']
from fslinstaller import *
manifest = get_web_manifest(Settings.mirror)
import json
with open('/manifest.json', 'w') as fp:
... json.dump(manifest, fp)
...
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: '
/manifest.json'

Is the path in the open command incorrect? Or is it possible we've picked up an installer with a different file structure? I downloaded FSL 6.0.1 for Centos7. My apologies for being so unfamiliar with the interpreter.

Thanks again,

Matt

@msp-trc
Copy link

msp-trc commented Jul 18, 2019

the tilde () is vanishing from the previous ('/manifest.json) in both locations (code and error msg)

@Carles567
Copy link

Hey, how did it go? Did you manage to install it?

@lkoelman
Copy link
Author

lkoelman commented Aug 4, 2019

Hey guys,

I don't know why the tilde is vanishing in your interpreter but it's not important. Just use any valid file path that is writable to you which let's you open the downloaded json file.

Or even just print out the manifest content in your interpreter using print(manifest) instead of writing it to file.

Cheers,
Lucas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment