Skip to content

Instantly share code, notes, and snippets.

@vfmatzkin
Last active April 3, 2024 22:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfmatzkin/7987a6edf034d28427696e1fabbb2979 to your computer and use it in GitHub Desktop.
Save vfmatzkin/7987a6edf034d28427696e1fabbb2979 to your computer and use it in GitHub Desktop.
FSL installation in Google colab
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "FSL installation in Google colab",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyPQy2FepmlnrIBzeKsjPPxZ",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/vfmatzkin/7987a6edf034d28427696e1fabbb2979/fsl-installation-in-google-colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "51eIk8m-ljpZ"
},
"source": [
"Here I leave a little snippet on how to install FSL in colab. \n",
"I realized that the installation failed when it tried to run \"file ..\" in order to determine the temporal downloaded tar.gz filetype, so installing 'file' will fix that up.\n",
"\n",
"The installation process can take up to 10 minutes."
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "DvwX9svW7W4Q",
"outputId": "9d2077bd-dd46-432d-9f6c-b0d9ee6bd5c3"
},
"source": [
"import os\n",
"\n",
"!sudo apt -qq install file\n",
"!wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py\n",
"!python2 fslinstaller.py\n",
"\n",
"fslpath = \"/usr/local/fsl\"\n",
"os.environ[\"FSLDIR\"] = fslpath\n",
"os.environ[\"PATH\"] += os.pathsep + os.path.join(fslpath, 'bin')\n",
"!. ${FSLDIR}/etc/fslconf/fsl.sh\n",
"\n",
"!flirt -version"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"The following additional packages will be installed:\n",
" libmagic-mgc libmagic1\n",
"The following NEW packages will be installed:\n",
" file libmagic-mgc libmagic1\n",
"0 upgraded, 3 newly installed, 0 to remove and 16 not upgraded.\n",
"Need to get 275 kB of archives.\n",
"After this operation, 5,297 kB of additional disk space will be used.\n",
"debconf: unable to initialize frontend: Dialog\n",
"debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 3.)\n",
"debconf: falling back to frontend: Readline\n",
"debconf: unable to initialize frontend: Readline\n",
"debconf: (This frontend requires a controlling tty.)\n",
"debconf: falling back to frontend: Teletype\n",
"dpkg-preconfigure: unable to re-open stdin: \n",
"Selecting previously unselected package libmagic-mgc.\n",
"(Reading database ... 145483 files and directories currently installed.)\n",
"Preparing to unpack .../libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...\n",
"Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...\n",
"Selecting previously unselected package libmagic1:amd64.\n",
"Preparing to unpack .../libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...\n",
"Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n",
"Selecting previously unselected package file.\n",
"Preparing to unpack .../file_1%3a5.32-2ubuntu0.4_amd64.deb ...\n",
"Unpacking file (1:5.32-2ubuntu0.4) ...\n",
"Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...\n",
"Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n",
"Setting up file (1:5.32-2ubuntu0.4) ...\n",
"Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n",
"Processing triggers for libc-bin (2.27-3ubuntu1.2) ...\n",
"/sbin/ldconfig.real: /usr/local/lib/python3.6/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n",
"\n",
"--2021-01-18 22:37:15-- https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py\n",
"Resolving fsl.fmrib.ox.ac.uk (fsl.fmrib.ox.ac.uk)... 129.67.248.65\n",
"Connecting to fsl.fmrib.ox.ac.uk (fsl.fmrib.ox.ac.uk)|129.67.248.65|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 100244 (98K) [application/octet-stream]\n",
"Saving to: ‘fslinstaller.py’\n",
"\n",
"fslinstaller.py 100%[===================>] 97.89K 250KB/s in 0.4s \n",
"\n",
"2021-01-18 22:37:16 (250 KB/s) - ‘fslinstaller.py’ saved [100244/100244]\n",
"\n",
"\u001b[1m--- FSL Installer - Version 3.0.21 ---\u001b[0m\n",
"When asked a question, the default answer is given in square brackets.\n",
"Hit the Enter key to accept this default answer.\n",
"Where would you like the FSL install to be (including the FSL folder name)? [/usr/local/fsl]: \n",
"Downloading...\n",
"Checking FSL package\n",
"\u001b[92m[OK] \u001b[0mFile downloaded\n",
"Installing FSL software version 6.0.4...\n",
"-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|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\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b|\b/\b-\b\\\b\u001b[92m[OK] \u001b[0mFSL software installed.\n",
"|\bPerforming post install tasks\n",
"/\bPatching asl_gui for fsl 6.0.4\n",
"Stage 1\n",
"By installing this python distribution you agree to the license terms in\n",
"/usr/local/fsl/fslpython/LICENSE.txt\n",
"100%\n",
"Stage 2\n",
"100%\n",
"/tmp/fslpython6fph/fslpython_miniconda_installer.log\n",
"configure_eddy.sh: /usr/local/fsl/bin/eddy NOT detected. Checking for /usr/local/fsl/bin/eddy_openmp.\n",
"configure_eddy.sh: /usr/local/fsl/bin/eddy_openmp detected. Creating symlink to /usr/local/fsl/bin/eddy now.\n",
"configure_eddy.sh: /usr/local/fsl/bin/eddy_cuda NOT detected. Checking for specific eddy_cudaX.X versions now.\n",
"configure_eddy.sh: found eddy_cuda versions... /usr/local/fsl/bin/eddy_cuda8.0 /usr/local/fsl/bin/eddy_cuda9.1\n",
"configure_eddy.sh: checking /opt/cuda* for installed cuda versions\n",
"configure_eddy.sh: no cuda found in /opt/cuda (or no access)\n",
"configure_eddy.sh: checking /usr/local/cuda for installed cuda versions\n",
"configure_eddy.sh: found cuda versions: /usr/local/cuda /usr/local/cuda-10.0 /usr/local/cuda-10.1\n",
"Post install setup complete\n",
"\u001b[92m[OK] \u001b[0mPost installation setup complete\n",
"FLIRT version 6.0\n"
],
"name": "stdout"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment