muschellij2 / freesurfer

Freesurfer Port to R
10 stars 5 forks source link

recon-all error #9

Closed snaillyd closed 4 years ago

snaillyd commented 5 years ago

Hi, I got an error message when I use scipt 'recon_all(infile = paste0(detination,ID,'.nii.gz'),subjid=ID,verbose = TRUE,opts = '-all')' The error message is: sh: 66: /usr/local/freesurfer/FreeSurferEnv.sh: [[: not found sh: 66: /usr/local/freesurfer/FreeSurferEnv.sh: -z: not found sh: 86: /usr/local/freesurfer/FreeSurferEnv.sh: [[: not found sh: 119: /usr/local/freesurfer/FreeSurferEnv.sh: [[: not found sh: 119: /usr/local/freesurfer/FreeSurferEnv.sh: 0: not found sh: 123: /usr/local/freesurfer/FreeSurferEnv.sh: [[: not found sh: 123: /usr/local/freesurfer/FreeSurferEnv.sh: 0: not found sh: 127: /usr/local/freesurfer/FreeSurferEnv.sh: Syntax error: word unexpected (expecting "then")

Could you help me out?

muschellij2 commented 5 years ago

Are you running this in RStudio or the Terminal?

Also please provide a MCVE: https://stackoverflow.com/help/mcve.

snaillyd commented 5 years ago

I tried running this in both RStudio and R Terminal,and got the same error message. However, no error presented when I use freesurfer recon-all in Terminal.

muschellij2 commented 5 years ago

Can you provide a MCVE?

It seems as though you should be calling bash, but it's not. Do you have specific things done in your .profile or .bash_profile or .bashrc that change environment variables?

Can you also provide the output of this code:

freesurferdir = Sys.getenv("FREESURFER_HOME")
freesurferdir
head(readLines("/usr/local/freesurfer/FreeSurferEnv.sh"), 3)
freesurfer::fs_version()
muschellij2 commented 5 years ago

Also

system("/bin/bash --version")
system("/bin/sh --version")
snaillyd commented 5 years ago

image

snaillyd commented 5 years ago

image

muschellij2 commented 5 years ago

Seems as though bash should be called here. I don't know why it's failing. The .sh file would fail if run by sh, so I understand why that may be the case. This may be related to source vs. . as is related to https://github.com/muschellij2/freesurfer/issues/6. Can you run

system("source /usr/local/freesurfer/FreeSurferEnv.sh")
system(". /usr/local/freesurfer/FreeSurferEnv.sh")
system("sh /usr/local/freesurfer/FreeSurferEnv.sh")

in R and give output?

snaillyd commented 5 years ago

image

muschellij2 commented 5 years ago

Please run that in Terminal R and provide output.

Also try system("bash /usr/local/freesurfer/FreeSurferEnv.sh") John

On Wed, May 15, 2019 at 6:57 PM snaillyd notifications@github.com wrote:

[image: image] https://user-images.githubusercontent.com/28690261/57814854-a56ae280-77a7-11e9-8931-a9531aed5def.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/muschellij2/freesurfer/issues/9?email_source=notifications&email_token=AAIGPLTQW7PK7JH6G3DECILPVSIN5A5CNFSM4HM7IMHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVQFZDA#issuecomment-492854412, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIGPLXLOS4Z6OOGSFKBX6LPVSIN5ANCNFSM4HM7IMHA .