james-cole / brainageR

Software for generating a brain-predicted age value, using Gaussian Processes regression, implemented in R
GNU Lesser General Public License v3.0
76 stars 27 forks source link

Setup issue (with [[ and modules not found) #1

Closed jlhanson5 closed 2 years ago

jlhanson5 commented 6 years ago

Hello!

I was trying to test drive brainageR, but ran into some setup issues. I wasn't sure what I might be doing wrong. I'm on an ubuntu machine, with everything installed (as far as I can tell).

Here's my directory structure...

setup

(FYI- I initially cloned the git repo, but then pulled the Zenodo files... but ran into an issue removing that brainageR-master directory)

And then here's my command line output--

untitled

Thoughts on what I might be doing incorrectly? I've uploaded the brainageR script with appropriate paths, etc. Other thoughts? Thanks much in advance!

All the best, Jamie.

james-cole commented 6 years ago

Thanks for your message and sorry for the delay in getting back to you.

From the error message, it looks like an issue with the version of grep that you have on your system. There's a command that just checks with the filename ends *.nii. I think you need the BSD version rather than the GNU version. Actually, the latest version of the main 'brainageR' script on Github doesn't have this call, so you could try that one. Or comment out the brainageR script line with grep (Zenodo version), or change the version of grep that you're using.

Let me know if that fixes it. If not, send me some more error messages and I'll try to figure it out!

Thanks also for your interest in my software, apologies if it's a bit buggy.

jlhanson5 commented 6 years ago

Hmmm, I'm re-downloaded the repo, but ran into the same module error. Is there a dev version of things I'm missing? At present, I can't get SPM called correctly (and/or I can't get SPM to execute its segmentation routine).


If I include full paths (after adding brainageR to my path), I get the following output--

`jamielh@pfc:~/Volumes/Hanson/Neuroimaging_Resources/brainageR/software$ brainageR -f ./20110310_12401_T1.nii -o ./20110310_12401_T1_BA.csv /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 48: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: [[: not found /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 50: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: module: not found /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 51: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: module: not found /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 52: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: module: not found find: warning: Unix filenames usually don't contain slashes (though pathnames do). That means that '-name ‘./20110310_12401_T1.nii’' will probably evaluate to false all the time on this system. You might find the '-wholename' test more useful, or perhaps '-samefile'. Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ ‘./20110310_12401_T1.nii’'. MATLAB is selecting SOFTWARE OPENGL rendering.

                                                                                                                                    < M A T L A B (R) >
                                                                                                                          Copyright 1984-2016 The MathWorks, Inc.
                                                                                                                           R2016b (9.1.0.441655) 64-bit (glnxa64)
                                                                                                                                     September 7, 2016

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.

Item 'Volumes', field 'val': Number of matching files (0) less than required (1). Error using spm_jobman>fill_run_job (line 472) No executable modules, but still unresolved dependencies or incomplete module inputs.

Error in spm_jobman (line 247) sts = fill_run_job('run', cjob, varargin{3:end});

Error in spm_preprocess_brainageR (line 103) spm_jobman('run', matlabbatch);`


If I instead attempt to specify a local file, things move forward but SPM crashes...

`jamielh@pfc:~/Volumes/Hanson/Neuroimaging_Resources/brainageR/software$ brainageR -f 20110310_12401_T1.nii -o 20110310_12401_T1_BA.csv /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 48: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: [[: not found /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 50: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: module: not found /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 51: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: module: not found /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 52: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: module: not found MATLAB is selecting SOFTWARE OPENGL rendering.

                                                                                                                                    < M A T L A B (R) >
                                                                                                                          Copyright 1984-2016 The MathWorks, Inc.
                                                                                                                           R2016b (9.1.0.441655) 64-bit (glnxa64)
                                                                                                                                     September 7, 2016

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.


Running job #1

Running 'Segment'

SPM12: spm_preproc_run (v6365) 17:01:23 - 29/08/2018

Segment /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/20110310_12401_T1.nii,1 Failed 'Segment' Error using spm_vol>spm_vol_hdr (line 80) File "/home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/20110310_12401_T1.nii" does not exist. In file "/usr/local/pkg/spm12/spm_vol.m" (v5958), function "spm_vol_hdr" at line 80. In file "/usr/local/pkg/spm12/spm_vol.m" (v5958), function "spm_vol" at line 61. In file "/usr/local/pkg/spm12/spm_preproc_run.m" (v6365), function "run_job" at line 84. In file "/usr/local/pkg/spm12/spm_preproc_run.m" (v6365), function "spm_preproc_run" at line 41. In file "/usr/local/pkg/spm12/config/spm_cfg_preproc8.m" (v6952), function "spm_local_preproc_run" at line 450.

No executable modules, but still unresolved dependencies or incomplete module inputs. The following modules did not run: Failed: Segment Skipped: Run Dartel (existing Templates) Skipped: Normalise to MNI Space Skipped: Tissue Volumes

Error using MATLABbatch system Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines (look for the line showing the exact #job as displayed in this error message)

Running job #1

`


I can potentially change my grep version (but I would rather now). Other thoughts to troubleshoot things?

Thanks much! Jamie.

james-cole commented 6 years ago

Hi Jamie, Sorry about this and thanks for perservering. Seems like something fundamental is going wrong up top, rather than it being a specific MATLAB issue. Can I check which version of bash you're using? Also do you have Lmod or Modules installed? It's saying 'module' command not found in the error message, so something isn't right there.

Do you want to try calling brainageR using bash with the -x parameter, e.g.:

command_prompt$ bash -x brainageR -f t1.nii -o output.csv

jlhanson5 commented 6 years ago

Ah this might help pintpoint things...

jamielh@pfc:~/Volumes/Hanson/Neuroimaging_Resources/brainageR/software$ bash -x brainageR -f /home/jamielh/Volumes/Hanson/FastTrack/derivatives/20110310_12401_T1.nii -o /home/jamielh/Volumes/Hanson/FastTrack/derivatives/20110310_12401_T1_BA.csv

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.

Item 'Volumes', field 'val': Number of matching files (0) less than required (1). Error using spm_jobman>fill_run_job (line 472) No executable modules, but still unresolved dependencies or incomplete module inputs.

Error in spm_jobman (line 247) sts = fill_run_job('run', cjob, varargin{3:end});

Error in spm_preprocess_brainageR (line 103) spm_jobman('run', matlabbatch);


As an FYI, matlab, R, and other software are in my PATH, so they launch when I type only their names into a prompt. (I just wasn't familiar with module).

Also, I looked and I'm using:

Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-130-generic x86_64)

Modules Release 3.2.10 2012-12-21 (Copyright GNU GPL v2 1991):

Sorry for all my errors/issues! Thoughts on all that? And thanks for the assistance.

All the best, Jamie.

james-cole commented 6 years ago

OK, so trying commenting out lines 50-52 in the 'brainageR' script. Also, can you change directory to the directory where your nifti file is and just enter the filename (so not the whole path), don't run brainageR from the software directory.

Give that a go and see how you get on.

jlhanson5 commented 6 years ago

Hmm, still no luck...

Here's my commands and output...

jamielh@pfc:~/Volumes/Hanson/FastTrack/derivatives$ brainageR -f 20110310_12401_T1.nii -o 20110310_12401_T1_BA.csv /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: 48: /home/jamielh/Volumes/Hanson/Neuroimaging_Resources/brainageR/software/brainageR: [[: not found MATLAB is selecting SOFTWARE OPENGL rendering.

                                                                                                                              < M A T L A B (R) >
                                                                                                                    Copyright 1984-2016 The MathWorks, Inc.
                                                                                                                    R2016b (9.1.0.441655) 64-bit (glnxa64)
                                                                                                                               September 7, 2016

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.


Running job #1

Running 'Segment'

SPM12: spm_preproc_run (v6365) 11:08:54 - 30/08/2018

Segment /home/jamielh/Volumes/Hanson/FastTrack/derivatives/home/jamielh/Volumes/Hanson/FastTrack/derivatives/20110310_12401_T1.nii,1 Failed 'Segment' Error using spm_vol>spm_vol_hdr (line 80) File "/home/jamielh/Volumes/Hanson/FastTrack/derivatives/home/jamielh/Volumes/Hanson/FastTrack/derivatives/20110310_12401_T1.nii" does not exist. In file "/usr/local/pkg/spm12/spm_vol.m" (v5958), function "spm_vol_hdr" at line 80. In file "/usr/local/pkg/spm12/spm_vol.m" (v5958), function "spm_vol" at line 61. In file "/usr/local/pkg/spm12/spm_preproc_run.m" (v6365), function "run_job" at line 84. In file "/usr/local/pkg/spm12/spm_preproc_run.m" (v6365), function "spm_preproc_run" at line 41. In file "/usr/local/pkg/spm12/config/spm_cfg_preproc8.m" (v6952), function "spm_local_preproc_run" at line 450.

No executable modules, but still unresolved dependencies or incomplete module inputs. The following modules did not run: Failed: Segment Skipped: Run Dartel (existing Templates) Skipped: Normalise to MNI Space Skipped: Tissue Volumes

Error using MATLABbatch system Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines (look for the line showing the exact #job as displayed in this error message)

Running job #1


I'm using matlab R2016b, maybe there's a version issue there? Other thoughts?

Sorry for all the challenge! Jamie.

james-cole commented 6 years ago

Interesting, I'm not sure it's a matlab problem - try commenting out line #56 and run it again. If you can use bash -x again that'd be really helpful.

jlhanson5 commented 6 years ago

Ahh, that looks to be working... SPM segment has at least completed.

james-cole commented 6 years ago

Sounds promising!

jlhanson5 commented 6 years ago

Yes, just got it to finish (with the one subject). Thanks again for all the assistance!

james-cole commented 6 years ago

Great stuff. I'll update the code/instructions soon as I can. Thanks for the help testing, it's really useful to find these bugs.

marivas-MRI commented 3 years ago

Dear James,

I tried to run the brainageR software taking into account this previous issue but I have the same issue.

  1. I changed use realpath instead of readlink (I am using a Mac)
  2. I commented out out the lines 50-52 and 56 in brainageR script.

The output is very similar to one previously reported:

(base) rmnlab1:brainageR neucoga$ bash -x brainageR -f /Users/neucoga/Desktop/normalisation/01_t1_native/4001.nii -o prueba.csv

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.

Item 'Volumes', field 'val': Number of matching files (0) less than required (1). Error using spm_jobman>fill_run_job (line 472) No executable modules, but still unresolved dependencies or incomplete module inputs.

Error in spm_jobman (line 247) sts = fill_run_job('run', cjob, varargin{3:end});

Error in spm_preprocess_brainageR (line 102) spm_jobman('run', matlabbatch);

P.D. I am running brainageR from the software directory. If I would like to run the software from the directory where I have my nifti files, what command should to set the software in my terminal? maybe using the command export? Sorry for this simple questions but I am a not familiar with bash terminals.

Thank you so much in advance!.

Miguel,

james-cole commented 3 years ago

Hi Miguel,

Thanks for your interest in brainageR. Sorry it's not proving straightforward.

From what i can see, the error message still seems to be trying to use 'readlink', so perhaps double check that the file where you edited it to use realpath instead is properly saved with the correct filename (brainageR). Hope that helps - let me know if you have any further issues. James

marivas-MRI commented 3 years ago

Hi James,

Thanks for your reply. I tried using realpath (editing line 47 in brainageR file)

full_path_file=realpath -f $input_file file_name=basename -s .nii $full_path_file full_path=echo $full_path_file | sed -e "s@${file_name}.nii@@"

But the output is the same

rmnlab1:brainageR neucoga$ bash -x brainageR -f /Users/neucoga/Desktop/normalisation/01_t1_native/4001.nii -o prueba.csv

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.

Item 'Volumes', field 'val': Number of matching files (0) less than required (1). Error using spm_jobman>fill_run_job (line 472) No executable modules, but still unresolved dependencies or incomplete module inputs.

Error in spm_jobman (line 247) sts = fill_run_job('run', cjob, varargin{3:end});

Error in spm_preprocess_brainageR (line 102) spm_jobman('run', matlabbatch);

Thank you.

Miguel,

james-cole commented 3 years ago

Hi Miguel, It now says 'realpath: command not found'. Please check you have this available on your system. Best wishes, James

marivas-MRI commented 3 years ago

Hi James,

Sorry for this stupid error, I though that realpath was available on my system. I installed realpath and things seems to worked fine, segmentation, MNI Normalisation, Tissue Volume estimation and age prediction finished succesfully. However there is a problem when creating the quality control files and the htlm report.

As you can see in my output, these issues could be related to readlink but I do not know how should I modify appropiately the brainageR script. Below you can see the output. I also attached the brainageR script file if you want to take a look.

rmnlab1:brainageR neucoga$ bash -x brainageR -f /Users/neucoga/Desktop/normalisation/01_t1_native/4001.nii -o prueba.csv

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.


29-Mar-2021 14:28:30 - Running job #1

29-Mar-2021 14:28:30 - Running 'Segment'

SPM12: spm_preproc_run (v7408) 14:28:30 - 29/03/2021

Segment /Users/neucoga/Desktop/normalisation/01_t1_native/4001.nii,1 Completed : 14:30:32 - 29/03/2021 29-Mar-2021 14:30:32 - Done 'Segment' 29-Mar-2021 14:30:32 - Running 'Run Dartel (existing Templates)' rc14001 1 416576 0 416576 333.454 2 317320 18285.8 335606 118.093 3 302444 23532.6 325977 41.9188 4 297249 12587.4 309837 134.939 5 279453 23807.2 303260 42.6342 6 278074 24696.1 302770 24.6181 7 276958 12582.6 289541 113.042 8 260536 23171.3 283707 35.3169 9 259908 23427.8 283335 21.4179 10 258987 11989.9 270977 96.7081 11 243113 22230.7 265343 33.6522 12 242424 22467.8 264892 21.8331 13 242566 11602.9 254169 78.8464 14 228615 20395.6 249011 31.2196 15 227459 20957.1 248416 21.8218 16 226980 21821.5 248802 26.4377 17 226653 21778.9 248432 19.7686 18 226239 22126.7 248366 18.4249 29-Mar-2021 14:33:12 - Done 'Run Dartel (existing Templates)' 29-Mar-2021 14:33:12 - Running 'Normalise to MNI Space'

"u_rc14001" c14001 1,1,1 c24001 1,1,1 c34001 1,1,1 29-Mar-2021 14:33:18 - Done 'Normalise to MNI Space' 29-Mar-2021 14:33:18 - Running 'Tissue Volumes'

Segmentation files: /Users/neucoga/Desktop/normalisation/01_t1_native/4001_seg8.mat

Volumes (litres): 0.5464 0.3925 0.3585

29-Mar-2021 14:34:00 - Done 'Tissue Volumes' 29-Mar-2021 14:34:00 - Done

Finished. To view, point your web browser at file:/slicesdir_4001.nii/index.html

Thank you so much. Best regards,

Miguel. brainageR.zip

james-cole commented 3 years ago

Looking at the error you shared, I think it's still trying to use readlink at some stage. Also, do check that you have FSL installed correctly.

marivas-MRI commented 3 years ago

Yes, the problem was in the slicesdir.brainageR file which was using readlink instead of realpath. I edited also that file and now also worked fine.

Thank you very much and congratulations for your work!

maxencewynen commented 3 years ago

Hello !

I am trying to run brainageR, but ran into an issue during the spm12 step. I am on an ubuntu 18 machine with (I think) everything installed and configured correctly.

This is my directory structure and the error message I get: image image

Do you have any idea what I might be doing wrong here?

Thanks a lot, Best, Maxence

james-cole commented 3 years ago

Hi Maxence, Thanks for your interest in brainageR.

I think you might just be missing a forward slash in your spm12 pathway in the brainageR script. It's looking for a directory spm12tpm but needs to be spm12/tpm

Hope that helps, Best wishes, James


From: Maxence Wynen @.> Sent: 06 August 2021 1:54 PM To: james-cole/brainageR @.> Cc: Cole, James @.>; State change @.> Subject: Re: [james-cole/brainageR] Setup issue (with [[ and modules not found) (#1)

Hello !

I am trying to run brainageR, but ran into an issue during the spm12 step. I am on an ubuntu 18 machine with (I think) everything installed and configured correctly.

This is my directory structure and the error message I get: [image]https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F17831504%2F128509257-fc790013-582b-4561-ad35-8acbb9662f56.png&data=04%7C01%7Cjames.cole%40ucl.ac.uk%7C10471e82ee0f42ef161e08d958d96351%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637638512957990277%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hkgrFc73%2BwgLZbvBvNDXN156hxEhxDteua45lKz5EYM%3D&reserved=0 [image]https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F17831504%2F128509361-f132fd65-ad43-42c4-bd19-f03c61766a99.png&data=04%7C01%7Cjames.cole%40ucl.ac.uk%7C10471e82ee0f42ef161e08d958d96351%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637638512958000227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KLmip29cR0PlKuoCbWn%2FgnPhlVrwn%2F8omcFgV4Nppmg%3D&reserved=0

Do you have any idea what I might be doing wrong here?

Thanks a lot, Best, Maxence

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/james-cole/brainageR/issues/1#issuecomment-894239741, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACCUV6E66JTNJDCMLIZQJKLT3PLR3ANCNFSM4FQX4AQA. Triage notifications on the go with GitHub Mobile for iOShttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cjames.cole%40ucl.ac.uk%7C10471e82ee0f42ef161e08d958d96351%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637638512958000227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Jog%2Fq%2BeutuB98lGzOq0OecE6uDa05nX1ThGN2PVkUCw%3D&reserved=0 or Androidhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26utm_campaign%3Dnotification-email&data=04%7C01%7Cjames.cole%40ucl.ac.uk%7C10471e82ee0f42ef161e08d958d96351%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637638512958010188%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=w7nOAAJtyHgDSEMvG6bkFi6TBqXaPcjYJY%2BUl%2Fc2iYg%3D&reserved=0.

maxencewynen commented 3 years ago

Indeed, it resolved my problem! Many thanks and congratulations for your work!