BDP – error initializing matlab runtime

Forums Forums BrainSuite Diffusion Pipeline (BDP) BDP – error initializing matlab runtime

This topic contains 18 replies, has 2 voices, and was last updated by  micaceous 3 months, 1 week ago.

  • Author
    Posts
  • #827

    micaceous
    Participant

    Hi BrainSuite team,

    I’m running Ubuntu Xenial (16.04) on Bash on Windows 10. I’ve installed BrainSuite without problems, and installed MCR R2015b *seemingly* without problems (following the instructions to add paths, in my .bashrc and .profile, to my LD_LIBRARY_PATH, as below…

    export LD_LIBRARY_PATH=/usr/lib/fsl/5.0:/usr/local/lib:/mnt/c/Users/Micaceous/Desktop/Research/Programs/matlab_compiler_runtime_R2015b/v90/runtime/glnxa64:/mnt/c/Users/Micaceous/Desktop/Research/Programs/matlab_compiler_runtime_R2015b/v90/bin/glnxa64:/mnt/c/Users/Micaceous/Desktop/Research/Programs/matlab_compiler_runtime_R2015b/v90/sys/os/glnxa64:${LD_LIBRARY_PATH}

    BFC runs fine, typing bdp.sh into terminal pulls up help menu, BUT when trying to execute bdp.sh I get the following message:

    An error has occurred while trying to initialize the MATLAB Runtime. The error is: Fatal error loading library /my/path/matlab_compiler_runtime_R2015b/v90/bin/glnxa64/libmwmclbase.so Error: libmwblas.so: cannot enable executable stack as shared object requires: Invalid argument Error:mclmcr initialization failed

    Could this be caused by my code for LD_LIBRARY_PATH? (I didn’t change anything from instructions)
    Or perhaps by something in the call to bdp.sh? Here’s what I’m calling:

    /mnt/c/Users/Micaceous/Desktop/Research/Programs/BrainSuite17a/bdp/bdp.sh 86_f000_Acute_anat_brain_RAS.bfc.nii.gz –dir=y –tensors –FRACT –t1-mask 86_f000_Acute_anat_brain_RAS.bfc.mask.nii.gz –dwi-mask 86_f000_Acute_dwi_QCed_fixorient_nodif_brain_mask.nii.gz –nii 86_f000_Acute_dwi_QCed_fixorient.nii.gz -g 86_f000_Acute_bvecs_QCed.txt -b 86_f000_Acute_bvals_QCed.txt

    Any help is greatly appreciated!
    Cheers,
    Micah

  • #843

    divarada
    Participant

    You will have to edit bdp.sh and change the path of the matlab compile runtime there.
    Remove # from
    #BrainSuiteMCR=”/path/to/your/MCR”;

    and add your path.

  • #844

    micaceous
    Participant

    Thanks for the reply. Yes I forgot to say, I definitely already followed those instructions, redefining it as follows…

    BrainSuiteMCR=”/mnt/c/Users/Micaceous/Desktop/Research/Programs/matlab_compiler_runtime_R2015b/v90″;

    – it’s correct to end with v90 right?

    Both files (referenced in error) exist (in the proper subdirectory that they mention):
    libmwblas.so
    libmwmclbase.so

    Don’t know if this is a problem, but the following directories (referring to the LD_LIBRARY_PATH section at end of bdp.sh) do NOT exist in my mcr folders:
    ${BrainSuiteMCR}/sys/java/jre/glnxa64/jre/lib/amd64/native_threads
    ${BrainSuiteMCR}/sys/java/jre/glnxa64/jre/lib/amd64/client
    ${BrainSuiteMCR}/X11

  • #845

    micaceous
    Participant

    Btw, although the MCR install instructions said to modify the LD_LIBRARY_PATH in bash profile, it does not seem to matter because bdp.sh already does this at the bottom of the script. I was worried that additionally adding it to my .bashrc was interfering somehow, so I removed it from .bashrc but the same error message appears so seems irrelevant.

  • #846

    micaceous
    Participant

    Could it be something about compatibility of new BrainSuite17a version with my system (I’m running Bash on Ubuntu on Windows)? If no other ideas to fix with 17a, I could try with 16a1

  • #847

    divarada
    Participant

    Both BrainSuite 16a1 and 17a use the same MCR – I doubt changing the executable will help.

    Can you check if your MCR folder needs have executable permissions ?

    I noticed that the error you shared has “/my/path/” printed in the path – Did you type this for the forum or is the actual path that got printed in the error ?
    Please check if all your paths are correct and accessible to bdp.sh.

  • #848

    divarada
    Participant

    *Can you check if your MCR folder has executable permissions ?

  • #849

    micaceous
    Participant

    I did chmod -R 777 on my mcr directory (/mnt/c/Users/Micaceous/Desktop/Research/Programs/matlab_compiler_runtime_R2015b/v90) and still same error. [yup I put “/my/path” just for the forum]

    I’ve rechecked all my paths so many times…the bdp.sh help on command line so I know it’s referenced correctly, and BFC works. And when I try to run bdp.sh, I’m not getting either of the error messages found inside the bdp.sh (“BDP could not locate…” or “BDP Could not find a valid…”), so I think this means that the runtime directory is referenced correctly

  • #850

    micaceous
    Participant

    I found a potential clue about clearing the executable stack, see link below for an example…could this be it? I’m going to try but not 100% sure how to do it correctly

    https://stackoverflow.com/questions/39136040/python3-4-error-cannot-enable-executable-stack-as-shared-object-requires-inva

  • #851

    micaceous
    Participant

    Alright, success! (it seems)

    Here’s what I did:

    sudo apt-get install execstack
    sudo execstack -c /mnt/c/Users/Micaceous/Desktop/Research/Programs/matlab_compiler_runtime_R2015b/v90/bin/glnxa64/lib*

    I think I saw a source online saying that this might be necessary after every time I reboot my computer, do you think so? Would there be an easy way around this? (perhaps by simply adding that last code to my script?)

  • #852

    micaceous
    Participant

    Almost successful…perhaps the following errors are related to my previous problems somehow?

    I’m getting an auto-masking failure error, which terminates bdp.sh

    “BDP encountered an error while estimating the brain-mask for the input diffusion volume…Please define a mask for diffusion volume by using flag –dwi-mask <mask_filename>. The mask can be generated and hand edited in BrainSuite interface”

    The strange thing is that I am including the –dwi-mask option, see my code below (note, this post shows two hyphens as one). And I rechecked that the mask is anatomically correct.

    /mnt/c/Users/Micaceous/Desktop/Research/Programs/BrainSuite17a/bdp/bdp.sh 86_f000_Acute_anat_brain_RAS.bfc.nii.gz –dir=y –tensors –FRACT –t1-mask 86_f000_Acute_anat_brain_RAS.bfc.mask.nii.gz –dwi-mask 86_f000_Acute_dwi_QCed_fixorient_nodif_brain_mask.nii.gz –nii 86_f000_Acute_dwi_QCed_fixorient.nii.gz -g 86_f000_Acute_bvecs_QCed.txt -b 86_f000_Acute_bvals_QCed.txt

    Any ideas?

  • #853

    divarada
    Participant

    Regarding execstack – We have not encountered this error before. So you will have to try and see if that command has to be executed each time. If so, it should be possible for you to add it to bdp.sh. Please do give us an update on that so we can add it to our FAQ.

    Regarding mask – Can you check your T1 mask as well.
    And share all the logs that BDP spits out on the terminal. That will help narrow down which masking step is failing.

  • #854

    micaceous
    Participant

    Yes certainly, I will report back on the execstack once I can reboot my computer.

    Regarding mask, yes the t1 mask looks good as well. In fact, I ran BDP successfully on these data before (on another linux system), and during my current tests all the code and data files are exactly the same, so it’s quite strange. It’s not recognizing that I’m submitting the –dwi-mask flag.

    Here is BDP log…

    BDP Version: 17a (build #0072), released 2017-06-22

    ================================================================================
    Setting up dataset and inputs
    ================================================================================
    Reading input flags…

    Checking input files…

    Processing data with fileprefix:
    86_f000_Acute_anat_brain_RAS

    ================================================================================
    Co-registration and Distortion Correction
    ================================================================================
    Reading the input parameters for co-registration…
    Total memory (physical+swap) found: 181.09GB

    Checking orientation information…Done
    Extracting 0-diffusion (b=0) image from input DWIs…

    ***************************************
    * *
    * Error running BDP *
    * *
    * AUTO-MASKING FAILED *
    * *
    ***************************************

    Error message:
    BDP encountered an error while estimating the brain-mask for the input diffusion
    volume.

    Error help/resolution:
    Please define a mask for diffusion volume by using flag –dwi-mask
    <mask_filename>. The mask can be generated and hand edited in BrainSuite
    interface.

    ***************************************

  • #855

    micaceous
    Participant

    Some more info that might be helpful…when BDP terminates with this mask error, it has created the following files, and two of these (86_f000_Acute_anat_brain_RAS.dwi.RAS.rearranged.b0s.nii, and 86_f000_Acute_anat_brain_RAS.bfc.nii) are not present in the BDP output from before when I had it working on another system (perhaps these are intermediate files which get cleaned up after, just thought I’d mention it).

    86_f000_Acute_anat_brain_RAS.dwi.RAS.rearranged.b0s.nii.gz
    86_f000_Acute_anat_brain_RAS.bfc.nii.gz
    86_f000_Acute_anat_brain_RAS.dwi.bmat
    86_f000_Acute_anat_brain_RAS.dwi.RAS.bmat
    86_f000_Acute_anat_brain_RAS.dwi.RAS
    86_f000_Acute_anat_brain_RAS.dwi.RAS.nii.gz

  • #859

    micaceous
    Participant

    Hi, any more ideas on what may be causing this mask error? I’m close to running out of time on this. Any more info I can give you? Many thanks!

  • #861

    divarada
    Participant

    Sorry for the delay.

    BDP refines the DWI mask that you provide to remove CSF region. Your logs and the fact that you have *.rearranged.b0s.nii result saved indicate that this step is crashing for the mask that you provided.
    If you can share the mask we can run it here and tell you what went wrong. Masking methods used in BDP are heuristic approaches that can fail for certain cases.

    Also, the following information will be helpful :
    Did you use the same mask before when it ran successfully for you ?
    Can you try running BDP without the DWI mask (no –dwi-mask) – Does it still throw an error ?

  • #869

    micaceous
    Participant

    Hi, thank you. I’m not sure yet how to put my image as http link, I will figure that out. But wouldn’t you also need my dwi and t1 files to see if you can recreate the errors on your end?

    So to answer your questions…
    – I used the same mask as before
    – I tried without the dwi-mask option, still throws an error (see below):

    Below is the log output from trying to run BDP without the –dwi-mask option:

    BDP Version: 17a (build #0072), released 2017-06-22

    ================================================================================
    Setting up dataset and inputs
    ================================================================================
    Reading input flags…

    Checking input files…

    Processing data with fileprefix:
    /mnt/y/jdelly_dti/DTIpipeline_Version2/86_f000_Acute/86_f000_Acute_anat_brain_RAS

    ================================================================================
    Co-registration and Distortion Correction
    ================================================================================
    Reading the input parameters for co-registration…
    Total memory (physical+swap) found: 181.09GB

    Checking orientation information…Done
    Extracting 0-diffusion (b=0) image from input DWIs…

    DWI mask is not defined in input flags. BDP will try to estimate a (pseudo) mask
    from 0-diffusion (b=0) image. Automatic mask estimation may not be accurate in
    some sitations and can affect overall quality of co-registration. In case
    co-registration is not accurate, you can define a DWI mask by using flag
    –dwi-mask <mask_filename>. The mask can be generated and hand edited in
    BrainSuite interface. This mask would be used only for registration purposes
    (and not for statistics computation).

    ***************************************
    * *
    * Error running BDP *
    * *
    * AUTO-MASKING FAILED *
    * *
    ***************************************

    Error message:
    BDP encountered an error while estimating the brain-mask for the input diffusion
    volume.

    Error help/resolution:
    Please define a mask for diffusion volume by using flag –dwi-mask
    <mask_filename>. The mask can be generated and hand edited in BrainSuite
    interface.

    ***************************************

  • #870

    micaceous
    Participant

    Btw, I rebooted my computer and I didn’t need to do that “execstack” code again in order to get BDP to run…although it’s possible that this “execstack” fix I found for my previous LD_LIBRARY_PATH error may be causing this BDP mask error I’m having now. What do you think?

  • #871

    micaceous
    Participant

    So far I’ve tested BDP on 3 different datasets (2 of which used to run successfully on another linux system), and all produce the same mask error, so it seems likely it’s not truly a mask problem. I’m guessing it has something to do with the fact that I’m running BrainSuite on Bash on Ubuntu on Windows, or because I had to do that “execstack” code fix earlier.

You must be logged in to reply to this topic.