error with R_io.so when checking afni_system_check.py -check_all to run run 3dLME

Hello,

I am trying to run 3dLME on our local lab mac machine that has had various versions of afni installed on it throughout the years. I recently updated the software to allow for needed R version and packages to be installed and updated our afni binaries. I also updated all other programs, such as homebrew, xcode, and x11. When I run the code, it doesn’t produce an error, just returns a new command line.

I believe I’ve narrowed it down to this error:

When I run afni_system_check.py -check_all to see what’s gone wrong, I consistently get the following error:

testing ability to start various programs…
afni : success
suma : success
3dSkullStrip : success
uber_subject.py : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
3dMVM : FAILURE
Error in dyn.load(ll) :
unable to load shared object ‘/Users/DSNLab/abin/R_io.so’:
dlopen(/Users/DSNLab/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
Referenced from: /Users/DSNLab/abin/R_io.so
Reason: image not found
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Execution halted

I’ve gone through prior message board posts and have tried different versions of the update afni binaries (and made sure other programs associated with afni were updated, but the error remains. Do you have other recommendations of what could be going wrong? Since this is a shard computer, could there be issues of multiple afni copies or things I’m not seeing/knowing to look for?

I’m also attaching the top of our 3dLME script below incase there is another issue as to why the script won’t run. (As for the F test, I just made an example one quickly to see if I could get the script to run, not necessarily interested in that f test. )

Thank you so much for your help!


#!/bin/bash
#---------------------------
#


cd /Volumes/DSNLab/NeuroTeen/analysis/Shapes/Shapes_3dLME_test \
3dLME -prefix 3dLME_v1 \
-model "reward*punishment*grade" \
-resid grade_resids \
-ranEff '~1+grade_c' \
-SS_type 3 \
-qVars "grade_c" \
-qVarsCenters "0,0" \
-mask \
-num_glf 1 \
-glfLabel 1 'Ant_grade' -glfCode 1 'Ant : 1*rew & 1*pun grade_c :' \
-dataTable \
Subj	Ant	grade_c	age	wave	Inputfile \
001	rew	1	12.96	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1001/con_001.nii \
001	pun	1	12.96	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1001/con_002.nii \
001	neu	1	12.96	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1001/con_003.nii \
003	rew	1	12.76	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1003/con_001.nii \
003	pun	1	12.76	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1003/con_002.nii \
003	neu	1	12.76	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1003/con_003.nii \
003	rew	3	15.16	wave3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3003/con_001.nii \
003	pun	3	15.16	wave3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3003/con_002.nii \
003	neu	3	15.16	wave3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3003/con_003.nii \
004	rew	1	13.07	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1004/con_001.nii \
004	pun	1	13.07	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1004/con_002.nii \
004	neu	1	13.07	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1004/con_003.nii \
005	rew	1	12.50	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1005/con_001.nii \
005	pun	1	12.50	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1005/con_002.nii \
005	neu	1	12.50	wave1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1005/con_003.nii \
005	rew	2	13.47	wave2	/Volume/DSNLab/NeuroTeen/subs/wave2/NT2005/con_001.nii \
005	pun	2	13.47	wave2	/Volume/DSNLab/NeuroTeen/subs/wave2/NT2005/con_002.nii \
005	neu	2	13.47	wave2	/Volume/DSNLab/NeuroTeen/subs/wave2/NT2005/con_003.nii \
005	rew	3	14.58	wave3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3005/con_001.nii \
005	pun	3	14.58	wave3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3005/con_002.nii \

Hi-

Could you please post the entire afni_system_check.py -check_all output? That will help us learn more about what OS you are using, what version of AFNI you have, etc. that we would need to know to be able to make any suggestions.

–pt

Hi,

Yes, here is the full output. Additional information that may be helpful is that we just updated our software to Catalina on our Mac.

Thank you!!

-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 19.6.0
version: Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64
distribution: 10.15.7
number of CPUs: 4
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/DSNLab/abin/afni
afni version : Precompiled binary macos_10.12_local: Oct 2 2020
: AFNI_20.3.00 ‘Vespasian’
AFNI_version.txt : AFNI_20.3.00, macos_10.12_local, Oct 02 2020
which python : /usr/local/bin/python
python version : 2.7.3
which R : /usr/local/bin/R
R version : R version 4.0.2 (2020-06-22) – “Taking Off Again”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/DSNLab/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.0/Resources/bin/R)
python : 2
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
python2 : 2
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
python3 : 1 (/usr/bin/python3)

testing ability to start various programs…
afni : success
suma : success
3dSkullStrip : success
uber_subject.py : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
3dMVM : FAILURE
Error in dyn.load(ll) :
unable to load shared object ‘/Users/DSNLab/abin/R_io.so’:
dlopen(/Users/DSNLab/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
Referenced from: /Users/DSNLab/abin/R_io.so
Reason: image not found
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Execution halted

checking for R packages…
rPkgsInstall -pkgs ALL -check : success

R RHOME : /Library/Frameworks/R.framework/Resources

checking for $HOME files…
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
++ module loaded: PyQt4
module file : /usr/local/lib/python2.7/site-packages/PyQt4/init.pyc

** have PyQt4, but cannot load QtCore, QtGui; error is:


Traceback (most recent call last):
File “”, line 1, in
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/PyQt4/QtCore.so, 2): Library not loaded: /usr/local/opt/qt@4/lib/QtCore.framework/Versions/4/QtCore
Referenced from: /usr/local/Cellar/pyqt@4/4.12.1_1/lib/python2.7/site-packages/PyQt4/QtCore.so
Reason: image not found


RuntimeError: module compiled against API version 9 but this version of numpy is 7
** failed to load module matplotlib.pyplot
– matplotlib.pyplot is not required, but is desirable

– python binaries under /usr/local/bin:
/usr/local/bin/python (sym link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
/usr/local/bin/python2 (sym link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
/usr/local/bin/python2.7 (sym link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)

-------------------------------- env vars --------------------------------
PATH = /usr/local/opt/php@7.2/sbin:/usr/local/opt/php@7.2/bin:/usr/local/opt/openssl@1.1/bin:/usr/local/ants/Scripts:/usr/local/ants/bin:/usr/local/fsl/bin:/sw/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/opt/ImageMagick/bin:/Users/DSNLab/abin:/Applications/MATLAB_R2016a.app/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin

PYTHONPATH = /usr/local/lib/python2.7/site-packages

R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas : found TT_N27+tlrc under /Users/DSNLab/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.7.11

which brew : /usr/local/bin/brew
brew version : Homebrew 2.5.4

++ found PyQt4 under /usr/local/lib/python2.7/site-packages
** consider linking /usr/local/Cellar/gcc/10.2.0/lib/gcc/10/libgomp.1.dylib under /usr/local/lib
++ found valid link /usr/local/lib/libglib-2.0.dylib
to …/Cellar/glib/2.66.1/lib/libglib-2.0.dylib
++ found 1 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
– recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell ‘bash’…
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace
– recent OS X, cheating to check DYLD_LIBRARY_PATH in shell ‘tcsh’…
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace

========================= summary, please fix: =========================

  • just be aware: login shell ‘bash’, but our code examples use ‘tcsh’
  • shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile
  • AFNI programs show FAILURE
  • check for partial install of PyQt4
  • insufficient data for AFNI bootcamp
  • consider linking /usr/local/Cellar/gcc/10.2.0/lib/gcc/10/libgomp.1.dylib under /usr/local/lib

Howdy-

Yes, this does point out what is happening with the main 3dLME error message. That program uses R, and unfortunately on Macs we only support using R v3.6.* at the moment, with the appropriate version to download linked here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_mac.html#install-r
→ Your current R version is “too modern”, 4.0*.

For this “Please Fix” comment:


* shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile

… could you please copy+paste this into a terminal:


echo "" >> ~/.bash_profile
echo "source ~/.bashrc" >> ~/.bash_profile
echo "" >> ~/.bash_profile

Any new terminal you open should be set for that now.

The note about partial install of PyQt4 is a bit odd… but I don’t think that will affect much of anything in practice. I am not sure about the linking message, perhaps one of the many people who knows more about such things than I do will comment on that…

–pt

Thank you! The error is resolved now when I run the afni_system_check.py.
However the script will not still not run. A new command line appears immediately and nothing is produce, including no error.

I’ve ensured bash scripts run properly, that the script is executable, that I’m in the correct directory to run the script. I’ve confirmed R and afni are both loaded.
Is there something else I did incorrectly in the snippet of script above?

Thanks again for your help!

What do you get when you run the following in R:

require(data.table)
sessionInfo()

At first I received an error when I ran require(data.table) indicating it could not be found and I was unable to download data.file, but I was able to install it with the command


install.packages("data.table", type = "binary")

Now my output is:


> require(data.table)
Loading required package: data.table
data.table 1.12.8 using 2 threads (see ?getDTthreads).  Latest news: r-datatable.com
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] data.table_1.12.8

loaded via a namespace (and not attached):
[1] compiler_3.6.3


I might be jumping the gun here, but I then tried the script again and it still didn’t work. I’ve then starting playing with the code to see if I could obtain an error. I now have an error to work with,


Error in if (len%%wd != 0) errex.AFNI(paste("The content under -dataTable is not rectangular !",  : 
  argument is of length zero
Calls: process.LME.opts
In addition: Warning messages:
1: In if (!is.na(lop$qVars)) lop$QV <- strsplit(lop$qVars, "\\,")[[1]] :
  the condition has length > 1 and only the first element will be used
2: In if (!is.na(lop$qVars)) lop$QV <- strsplit(lop$qVars, "\\,")[[1]] :
  the condition has length > 1 and only the first element will be used
Execution halted

I’ve since spent my time trying to figure out where missing or extra spaces could be and searching old errors on the afni message board and working in sublime text where I track exactly where my spaces are and are not. I saw a similar error and tried to follow the instruction to use file_tool to track down the source of the error.


file_tool -infiles test.sh -test
test.sh has 0 bad characters

test.sh file type: UNIX

This might be irrelevant if there were more I was supposed to do after the steps you asked above, but I wanted to include just incase.

Thanks again!

OK, you managed to fix the data.table issue!

Is this your 3dLME script?


3dLME -prefix 3dLME_v1 \
-model "reward*punishment*grade" \
-resid grade_resids \
-ranEff '~1+grade_c' \
-SS_type 3 \
-qVars "grade_c" \
-qVarsCenters "0,0" \
-mask \
-num_glf 1 \
-glfLabel 1 'Ant_grade' -glfCode 1 'Ant : 1*rew & 1*pun grade_c :' \
-dataTable \
Subj	Ant	grade_c	age	wave	Inputfile \

There are at least three issues:

** Where are the three variables reward, punishment and grade in the table?
** The variable “grade_c” is declared as a quantitative variables, but why are two center values provided through -qVarsCenters “0,0”?
** In the coding -glfCode 1 ‘Ant : 1rew & 1pun grade_c :’, the variable “rew” is not a column in the table, and all the three variables are not in the model formulation either.

Thank you!

I fixed the qvars to only indicate one centered variable and updated my model name to indicate table-level variable names only. I also deleted variables from the table that weren’t called in this simpler model in case that was also causing an issue?

I have a couple follow up questions. In the past using 3dLME, I had conditions specified under the table name (e.g., “Ant” as the table name and “rew” and “pun” as sub-conditions). Is that not the case or have I not properly specified “rew” and “pun” were being called from the “Ant” column? I added in a few of the subjects to reference where the “rew” and “pun” are coming from. I’m getting the same error, about table size so I know I’m still not indicating it correctly, but confused how else to specify those subconditions.

Thanks again!


3dLME -prefix 3dLME_v1 \
-model "Ant*grade_c" \
-resid grade_resids \
-ranEff '~1+grade_c' \
-SS_type 3 \
-qVars "grade_c" \
-qVarsCenters "0" \
-mask \
-num_glf 1 \
-glfLabel 1 'Ant_grade' -glfCode 1 'Ant : 1*rew & 1*pun grade_c :' \
-dataTable \
Subj	Ant	grade_c	Inputfile \
001	rew	1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1001/con_001.nii \
001	pun	1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1001/con_002.nii \
001	neu	1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1001/con_003.nii \
003	rew	1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1003/con_001.nii \
003	pun	1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1003/con_002.nii \
003	neu	1	/Volume/DSNLab/NeuroTeen/subs/wave1/NT1003/con_003.nii \
003	rew	3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3003/con_001.nii \
003	pun	3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3003/con_002.nii \
003	neu	3	/Volume/DSNLab/NeuroTeen/subs/wave3/NT3003/con_003.nii \

I actually just caught another error that is now allowing the program to run!

I had indicated “Inputfile” instead of “InputFile”

Thanks for all your help in fixing all the other errors I had prior to this typo!

Glad to know that you ironed out everything! I did see the typo of “Inputfile” last night, but the drowsiness overwhelmed me. :-o

Thank you! I have a follow up question. I successfully ran the script with a small batch of participants, but when I try to run it for all subjects, I receive the error


[1] "Great, test run passed at voxel (30, 54, 45)!"
[1] "Start to compute 91 slices along Z axis. You can monitor the progress"
[1] "and estimate the total run time as shown below."
[1] "10/13/20 13:58:15.452"
Error: vector memory exhausted (limit reached?)
Execution halted

I’m guessing this is a local machine issue with memory, but I wanted to check first to see if you had any suggestions on how to best trouble shoot this error or any tips to allow larger 3dlme batches to run on a local machine.

Thanks again!

Yes, it does look like you ran out of memory. Run it without any other jobs or find a computer with larger memory.

Great, thank you!

Hello,

I was just looking at this thread, and it looks like one of the original problems was not addressed, though it is a small one.

When you ran that original script, there was no error message, a new prompt just showed up. That is because there is a line continuation character '' at the end of the script. From the shell perspective, it is like typing a command but not hitting the return key. You can delete the final '', or even just add a newline at the end.

It seems like you are past that problem, but maybe it is worth mentioning.

  • rick

Thank you! Good to know for future problem solving!