muschellij2/fslr

/usr/lib/fsl/5.0/bin/fast: not found

Closed this issue · 14 comments

I have just installed FSL. It works fine from the terminal as well as the GUI. After I installed fslr I tested it by using the the fsl_biascorrect() function. Here is what I get back:

sh: 1: /usr/lib/fsl/5.0/bin/fast: not found
Error in oro.nifti::readNIfTI(..., reorient = reorient) : 
  File(s) not found!
In addition: Warning messages:
1: In file.remove(seg_file) :
  cannot remove file '/tmp/RtmpYkUvUs/file23d532a6435b_seg.nii.gz', reason 'No such file or directory'
2: In file.rename(output, outfile) :
  cannot rename file '/tmp/RtmpYkUvUs/file23d532a6435b_restore.nii.gz' to '/tmp/RtmpYkUvUs/file23d532a6435b.nii.gz', reason 'No such file or directory'

I believe I have set up the path and install correctly but I can go over what I did if necessary. have.fsl() returns TRUE.

The issue seems to be, I think, that fast and other relevant files are actually in /usr/lib/fsl/5.0/. There is no /bin folder at all. I am not sure why this is. I simply installed FSL via: sudo apt-get install fsl-5.0-complete. From what I can tell from the fslr command output to shell, fslr adds the /bin to the path automatically: ${FSLDIR}/bin/fast.

Do you think I have installed FSL incorrectly?

Please see my comment in #10

I used your script to create a /bin folder and copy everything to /usr/local/fsl/bin/. I then set options(fsl.path = "/usr/local/fsl"). However, I am still getting the error. I'm trying to troubleshoot but at the moment I'm still at a loss as to what is going on.

Can you be more explicit? Code + MWE required.

Here is the code I am running from my working directory. Note that I have removed the path name for privacy purposes.

### Load packages
library(fslr)
library(magrittr)
library(extrantsr)
library(oro.nifti)
library(ANTsR)

options(fsl.path = "/usr/local/fsl")
options(fsl.outputtype = "NIFTI_GZ")

mainDat <- [Path to data folder, external hard drive]

cue15Path <- paste(mainDat, "Cue_15", sep = "")
cue15Sub <- list.files(path = cue0Path, pattern = "364", all.files = TRUE)

### Preprocessing for cue15
fb1_files <- list.files(path = paste(cue15Path, "/", cue15Sub[1], sep = ""))
fb1_dat <- readnii(paste(cue15Path, "/", cue15Sub[1], "/", fb1_files[573], sep = ""))
bc_fb1 <- fsl_biascorrect(fb1_dat)

readnii() successfully loads the file and I can see from the terminal that the concatenated directory passed to this function indeed exists and contains the file of interest. When I run the code, everything goes through except the final line. I get the following error:


FSLDIR='/usr/local/fsl'; PATH=${FSLDIR}/bin:${PATH};export PATH FSLDIR; FSLOUTPUTTYPE=NIFTI_GZ; export FSLOUTPUTTYPE; ${FSLDIR}/bin/fast    -B --nopve --out="/tmp/RtmpBkZtWY/filef3d207c0b91" "/tmp/RtmpBkZtWY/filef3d554eb0d1.nii.gz";

/usr/local/fsl/bin/fast: error while loading shared libraries: libnewimage.so: cannot open shared object file: No such file or directory
Error in oro.nifti::readNIfTI(..., reorient = reorient) : 
  File(s) not found!
In addition: Warning messages:
1: In file.remove(seg_file) :
  cannot remove file '/tmp/RtmpBkZtWY/filef3d207c0b91_seg.nii.gz', reason 'No such file or directory'
2: In file.rename(output, outfile) :
  cannot rename file '/tmp/RtmpBkZtWY/filef3d207c0b91_restore.nii.gz' to '/tmp/RtmpBkZtWY/filef3d207c0b91.nii.gz', reason 'No such file or directory'

To check that the directory indeed contains the files:

➜  ~ cd /usr/local/fsl/bin                                                     
➜  bin find . -type f \( -name "fast" -o -name "libnewimage.so" \)
./fast
./libnewimage.so

Session info:

R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ANTsR_0.6.1       ANTsRCore_0.4.2.1 extrantsr_3.3.1.1 magrittr_1.5     
[5] fslr_2.14         neurobase_1.20.6  oro.nifti_0.7.6.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12        plyr_1.8.4          ITKR_0.4.12.3       compiler_3.4.0     
 [5] R.matlab_3.6.1      R.methodsS3_1.7.1   bitops_1.0-6        R.utils_2.5.0      
 [9] iterators_1.0.8     tools_3.4.0         magic_1.5-6         digest_0.6.12      
[13] yaImpute_1.0-26     jsonlite_1.5        WhiteStripe_2.2.2   tibble_1.3.4       
[17] nlme_3.1-131        lattice_0.20-35     mgcv_1.8-17         rlang_0.1.2        
[21] Matrix_1.2-10       psych_1.7.5         shiny_1.0.5         RNifti_0.7.0       
[25] yaml_2.1.14         parallel_3.4.0      knitr_1.17          stringr_1.2.0      
[29] htmlwidgets_0.9     hms_0.3             grid_3.4.0          R6_2.2.2           
[33] hash_2.2.6          rgl_0.98.1          foreign_0.8-69      readr_1.1.1        
[37] htmltools_0.3.6     matrixStats_0.52.2  splines_3.4.0       abind_1.4-5        
[41] assertthat_0.2.0    rsvd_0.6            mnormt_1.5-5        xtable_1.8-2       
[45] mime_0.5            httpuv_1.3.5        stringi_1.1.5       neuroim_0.0.6      
[49] RcppEigen_0.3.3.3.0 R.oo_1.21.0 

Let me know if you need anything else.

libnewimage.so should not be in the bin directory. Can you copy libnewimage (and all other lib files) to the /usr/local/fsl/lib/ directory and retry?

John

What Linux distro are you on? May be relevant: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=fsl;534aeecf.1606

Can you run fast at the command line?

What is your $LD_LIBRARY_PATH ?

What Linux distro are you on?

Ubuntu 16.04.2 LTS

Can you run fast at the command line?

No... I get the following error:
./fast: error while loading shared libraries: libnewimage.so: cannot open shared object file: No such file or directory

What is your $LD_LIBRARY_PATH ?

Running echo $LD_LIBRARY_PATH returns nothing. I use zshell so it's possible I never configured this properly when I set up the shell and it just never caused a problem until now.

Can you copy libnewimage (and all other lib files) to the /usr/local/fsl/lib/ directory and retry?

/usr/local/fsl/lib does not exist! There is only /bin and /data. I think you may be right about the neurodebian install and my distro. I created a lib folder and copied the files over. After restarting R and running everything again, I get the same error.

Maybe try: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Linux#Debian.2FUbuntu_users. I'm not sure zsh is supported by default: https://gist.github.com/methou/eab939aae92238fea48e

Have you tried fsl5.0-fast in the /usr/lib/fsl/5.0 directory (or try which fsl5.0-fast to see if it is in the PATH?

I would test the neurodeb distro to make sure that works. If it does, you may simply want to symlink those over.

I am really new to all this to be honest so I'm not really sure what I'm doing.

fsl5.0 is located in /usr/bin/fsl5.0-fast. If I run it, it works fine. I did the symlink and now echo $LD_LIBRARY_PATH returns /usr/lib/fsl/5.0 (/5.0 is now linked to /usr/share/fsl but this may not have been what you meant). I'm not really sure what the proper usage of the library path variable is so I'm trying to read up on that before I break anything further. I'm thinking about removing everything and just starting over at this point.

Sorry, this isn't really an fslr problem but I appreciate you trying to help me.

I'm not sure what other code/script I can provide you to reproduce my problem. Part of the issue is I am not exactly sure what will be useful for you because I am not sure how to fix the problem I am having. I can give you my directory structure relevant to fsl if that would help.

I don't understand what you mean by "If I run it, it works fine."

I misunderstood what you were asking above. I was indicating that fsl5.0-fast is able to start when evoked from the terminal. The R script still does not work.

I have linked /usr/local/fsl/bin and /usr/local/fsl/lib. From the terminal, running /usr/local/fsl/bin/fast starts the program. The parameters/optional commands come up on the screen. It does not give an error about shared libraries. I then restarted R and ran my script using the same options(fsl.path = "/usr/local/fsl"). I get the exact same error I listed in the post above where I gave my R code: /usr/local/fsl/bin/fast: error while loading shared libraries: libnewimage.so: cannot open shared object file: No such file or directory

Have you tried fast.help?

Do you mean the man page for fast? There isn't one... there is a man page for fsl and I have learned the following:

  • Need to run the configuration shell script (see 4. below)
  • The FSLDIR is /usr/share/fsl/5.0

Neither of these provide new information for me.

I purged fsl-5.0-complete from my system, including from /usr/local/fsl. Starting over from this point, hopefully this will serve as a MWE.

  1. Install package according to these instructions, for Ubuntu 16.04:
wget -O- http://neuro.debian.net/lists/xenial.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
sudo apt-get update
sudo apt-get install fsl-5.0-complete
  1. Check to see what directories were created upon fresh install. I see the following:
/etc/fsl/5.0/fsl.sh
/usr/bin/{fsl5.0* symlinked scripts}
/usr/lib/fsl/5.0 (all the lib files are located here plus everything else, including `fast`)
/usr/share/fsl/5.0 (bin and data subdirectories symlinked from /usr/lib/fsl/5.0)

Note that, by default installation, the lib files are in bin. There is no lib folder by itself.

  1. Other checks:
  • In R, have.fsl() returns TRUE.
  • echo $LD_LIBRARY_PATH returns /usr/lib/fsl/5.0
  • I can run fast from the terminal
  1. Debian/Ubuntu users are requested to run the configuration script to set path variables:
sudo chmod +x /etc/fsl/5.0/fsl.sh
/etc/fsl/5.0/fsl.sh  
  1. Attempt to run the R script posted above. I receive the exact same error.

  2. Look at the script you linked to in issue #10...

You originally pointed me in the direction of an earlier post with the following script. I have not yet run it yet in the MWE.

FSLDIR=/usr/local/fsl
FSLSHARE=/usr/share/data

mkdir -p ${FSLDIR}/bin && cp /usr/lib/fsl/5.0/* ${FSLDIR}/bin/
mkdir -p ${FSLDIR}/data/standard && mkdir -p ${FSLDIR}/data/atlases 

It seems that you are copying everything from /usr/lib/fsl/5.0 to a new directory called /usr/local/fsl/bin. What is the purpose of doing this and how will it help me?

Does this constitute an MWE you can work with? Is there anything else I can add?