R library issue while trying to run 3dLME

Hi all,

Noticed a couple of similar posts but they were older. Stumbled on a problem when trying to run 3dLME, seems that R libraries are not compatible. I’ve uninstalled and re-installed R to no avail. Hope I’ve included the relevant info below to help diagnose the problem! Please let me know what other info might be helpful. Many thanks for your help!

  1. SCRIPT USED and output with error:

[dk12r4003mac4:~/abin] user% /Volumes/LBM_HallKD/Data/Scripts/@3dLME_AllFoodXdiet.sh
set nonomatch
set mask = /Volumes/LBM_HallKD/Data/CFR_data/02-anatomical_masks/reward_circuit_mask_resampled+tlrc
set out_dir=/Volumes/LBM_HallKD/Data/CFR_data/

set prefix = 3dLME

cd /Volumes/LBM_HallKD/Data/CFR_data/

3dLME
-prefix 3dLME -jobs 4
-mask /Volumes/LBM_HallKD/Data/CFR_data/02-anatomical_masks/reward_circuit_mask_resampled+tlrc
-model 1
-ranEff ~1
-corStr order : AR1
-SS_type 3
-num_glt 3
-gltLabel 1 LFvLC -gltCode 1 diet : 1lowfat - 1lowcarb
-gltLabel 2 LFvB -gltCode 2 diet : 1lowfat - 1baseline
-gltLabel 3 LCvB -gltCode 3 diet : 1lowcarb - 1baseline
-num_glf 1
-glfLabel 1 dietcond -glfCode 1 diet : 1lowcarb & 1lowfat & 1*baseline
-dataTable Subj diet InputFile s307 baseline /Volumes/LBM_HallKD/Data/CFR_data/stats_files/psc_stats_files/func.o_s307_pscr_d1.psc.Composite.AM2_with_GAM.blur6mm.scale+tlrc.HEAD[ples_composite#0_Coef]

[… file list truncated for brevity…]

updating R_LD_LIBRARY_PATH …

oo Warning:
Failed to load R_io.so with this error message:

Error in dyn.load(ll) :
unable to load shared object ‘/Users/darceyvl/abin/R_io.so’:
dlopen(/Users/darceyvl/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
Referenced from: /Users/darceyvl/abin/R_io.so
Reason: image not found
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Execution halted

  1. MacOS: Mojave 10.14.6

  2. AFNI version: Precompiled binary macos_10.12_local: Jul 5 2020 (Version AFNI_20.2.00 ‘Aulus Vitellius’)

  3. R software

R was installed using the https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_mac.html#install-r

The first three lines from the output of the command line at the terminal: R --version

R version 3.6.3 (2020-02-29) – “Holding the Windsock”
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

Attempt to update R Packages (via terminal):

sudo rPkgsInstall -pkgs ALL
updating R_LD_LIBRARY_PATH …

oo Warning:
Failed to load R_io.so with this error message:

Error in dyn.load(ll) :
unable to load shared object ‘/Users/darceyvl/abin/R_io.so’:
dlopen(/Users/darceyvl/abin/R_io.so, 6): Library not loaded: /sw/lib/libjpeg.9.dylib
Referenced from: /Users/darceyvl/abin/R_io.so
Reason: Incompatible library version: R_io.so requires version 13.0.0 or later, but libjpeg.9.dylib provides version 12.0.0
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Execution halted
[dk12r4003mac4:~/abin] darceyvl% touch hello
[dk12r4003mac4:~/abin] darceyvl% ls hello
hello

–>Error in R (via R conosole):

first.in.path ← function(file) {

  • ff ← paste(strsplit(Sys.getenv(‘PATH’),‘:’)[[1]],‘/’, file, sep=‘’)
  • ff<-ff[lapply(ff,file.exists)==TRUE];
  • #cat(‘Using ‘, ff[1],’\n’);
  • return(gsub(‘//’,‘/’,ff[1], fixed=TRUE))
  • }

source(first.in.path(‘AFNIio.R’))
Error in if (file == “”) { : missing value where TRUE/FALSE needed

first.in.path ← function(file) {

  • ff ← paste(strsplit(Sys.getenv(‘PATH’),‘:’)[[1]],‘/’, file, sep=‘’)
  • ff<-ff[lapply(ff,file.exists)==TRUE];
  • #cat(‘Using ‘, ff[1],’\n’);
  • return(gsub(‘//’,‘/’,ff[1], fixed=TRUE))
  • }

source(first.in.path(‘AFNIio.R’))
Error in if (file == “”) { : missing value where TRUE/FALSE needed

(ll ← find.in.path(‘R_io.so’))
Error in find.in.path(“R_io.so”) : could not find function “find.in.path”
dyn.load(ll)
Error in dyn.load(ll) : object ‘ll’ not found

To be sure, what is the output from the following commands:

R RHOME
ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
3dMVM -help

For now, I would rather avoid dealing with “sudo rPkgsInstall”, as I am not sure how the DY* variables will propagate through sudo.

Thanks,

  • rick

Hi Rick,

Thanks - here are the outputs as requested:

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

ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
-rwxrwxr-x 1 root admin 3655012 Mar 5 2020 /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
-rwxrwxr-x 1 root admin 3655012 Mar 5 2020 /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib

3dMVM -help
updating R_LD_LIBRARY_PATH …

oo Warning:
Failed to load R_io.so with this error message:

Error in dyn.load(ll) :
unable to load shared object ‘/Users/darceyvl/abin/R_io.so’:
dlopen(/Users/darceyvl/abin/R_io.so, 6): Library not loaded: /sw/lib/libjpeg.9.dylib
Referenced from: /Users/darceyvl/abin/R_io.so
Reason: Incompatible library version: R_io.so requires version 13.0.0 or later, but libjpeg.9.dylib provides version 12.0.0
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Execution halted

Thanks for your help!

Just to provide some closure on this, we did a zoom chat to figure out what was going on.

It turns out that there was simply an older version of fink installed (for AFNI, which we used to request). That had the precise libjpeg.9.dylib path the R_io.so library was looking for, and so it did not use R_LD_LIBRARY_PATH (which is still surprising).

Once /sw was renamed to something different, the programs worked.

  • rick
1 Like

I have a similar problem.
When I run the three suggested commands, I get:

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

~: ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
-rwxrwxr-x 1 root admin 4071728 Jun 23 19:50 /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
-rwxrwxr-x 1 root admin 4071728 Jun 23 19:50 /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib

~: 3dMVM -help
updating R_LD_LIBRARY_PATH …

oo Warning:
Failed to load R_io.so with this error message:

Error in dyn.load(ll) :
unable to load shared object ‘/Users/knutsonk/abin/R_io.so’:
dlopen(/Users/knutsonk/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
Referenced from: /Users/knutsonk/abin/R_io.so
Reason: image not found
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Execution halted

Any help with this? Thanks.

Unfortunately, on macs we do not yet have a package compiled against R 4.0. As it stands, only 3.6 is supported.
Hopefully that can be rectified sometime within the next 7 years…

Sorry,

  • rick

Hi Rick –

I am having the same issue as BrainFood. Outputs you requested from them are below:


adamsteel% R RHOME
/Library/Frameworks/R.framework/Resources

ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
3dMVM -help[Adams-MacBook-Pro-3:/] adamsteel% ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib

[Adams-MacBook-Pro-3:/] adamsteel% 3dMVM -help
updating R_LD_LIBRARY_PATH ...

oo Warning: 
   Failed to load R_io.so with this error message:

Error in dyn.load(ll) : 
  unable to load shared object '/Users/adamsteel/abin/R_io.so':
  dlopen(/Users/adamsteel/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
  Referenced from: /Users/adamsteel/abin/R_io.so
  Reason: image not found
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted

Can you post more details re: the steps you used to fix the R_io.so problem?

What is your R version? Currently the R programs in AFNI only work with R 3.6.x on Mac OS. So, if your version is 4.x, one solution is to install R 3.6.x

I am also having this problem – here are the outputs requested from BrainFood.


adamsteel$ R RHOME
/Library/Frameworks/R.framework/Resources

adamsteel$  ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib

3dMVM -help
updating R_LD_LIBRARY_PATH ...

oo Warning: 
   Failed to load R_io.so with this error message:

Error in dyn.load(ll) : 
  unable to load shared object '/Users/adamsteel/abin/R_io.so':
  dlopen(/Users/adamsteel/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
  Referenced from: /Users/adamsteel/abin/R_io.so
  Reason: image not found
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted

Thanks!

Is this one of the newer systems, where R is not in your PATH? What is the output from:

R RHOME

Thanks,

  • rick

Hi Rick –

I’m running Mac OS Mojave 10.14.6

Output requested:


adamsteel$ R RHOME
/Library/Frameworks/R.framework/Resources

Just bumping this issue in case it was lost over the holiday -

I’m having the same problem described above. Running Mac OS 14.6 (Mojave).


adamsteel$ R RHOME
/Library/Frameworks/R.framework/Resources

Output requested from initial post (BrainFood)


adamsteel$ R RHOME
/Library/Frameworks/R.framework/Resources

adamsteel$  ls -l /Library/Frameworks/R.framework/Versions/*/Resources/lib/libR.dylib
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib

3dMVM -help
updating R_LD_LIBRARY_PATH ...

oo Warning: 
   Failed to load R_io.so with this error message:

Error in dyn.load(ll) : 
  unable to load shared object '/Users/adamsteel/abin/R_io.so':
  dlopen(/Users/adamsteel/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
  Referenced from: /Users/adamsteel/abin/R_io.so
  Reason: image not found
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted

What is your AFNI version (afni -ver)? What happens if you update your AFNI to the most recent version (@update.afni.binaries -d)?

Hi Gang –

I just updated afni, but I’m still having the problem. Here’s the output from afni -ver. and the call to 3dLME.


[Adams-MacBook-Pro-3:Projects/retinotopy/afni_prf] adamsteel% afni -ver
Precompiled binary macos_10.12_local: Dec  3 2021 (Version AFNI_21.3.10 'Trajan')
[Adams-MacBook-Pro-3:Projects/retinotopy/afni_prf] adamsteel% 3dLME
updating R_LD_LIBRARY_PATH ...

oo Warning: 
   Failed to load R_io.so with this error message:

Error in dyn.load(ll) : 
  unable to load shared object '/Users/adamsteel/abin/R_io.so':
  dlopen(/Users/adamsteel/abin/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
  Referenced from: /Users/adamsteel/abin/R_io.so
  Reason: image not found
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted

Sorry for dropping this. It is strange.
Let’s work down the directory tree and verify existence of expected links.

What is the output of:

echo ==== R.framework
ls -l /Library/Frameworks/R.framework/

echo ==== R.framework/Resources
ls -l /Library/Frameworks/R.framework/Resources/

echo ==== R.framework/Resources/lib
ls -l /Library/Frameworks/R.framework/Resources/lib/

echo ==== to be sure
cd /Library/Frameworks/R.framework/Resources
pwd -P

Thanks,

  • rick

No worries – here is the requested output:


[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% echo ==== R.framework/Resources/lib
==== R.framework/Resources/lib
[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% ls -l /Library/Frameworks/R.framework/Resources/lib/
total 21352
-rwxrwxr-x  1 root  admin  3655012 Mar  5  2020 libR.dylib
drwxrwxr-x  3 root  admin       96 Apr 26  2019 libR.dylib.dSYM
-rwxrwxr-x  1 root  admin   189496 Mar  5  2020 libRblas.0.dylib
lrwxr-xr-x  1 root  admin       16 Dec  1  2020 libRblas.dylib -> libRblas.0.dylib
drwxrwxr-x  3 root  admin       96 Apr 26  2019 libRblas.dylib.dSYM
-rwxrwxr-x  1 root  admin  2178856 Mar  5  2020 libRlapack.dylib
drwxrwxr-x  3 root  admin       96 Apr 26  2019 libRlapack.dylib.dSYM
-rwxrwxr-x  1 root  admin   845100 Mar  5  2020 libc++.1.dylib
-rwxrwxr-x  1 root  admin   216576 Mar  5  2020 libc++abi.1.dylib
-rwxrwxr-x  1 root  admin   277696 Mar  5  2020 libgcc_s.1.dylib
-rwxrwxr-x  1 root  admin  1617368 Mar  5  2020 libgfortran.3.dylib
-rwxrwxr-x  1 root  admin   584944 Mar  5  2020 libomp.dylib
-rwxrwxr-x  1 root  admin   284208 Mar  5  2020 libquadmath.0.dylib
-rwxrwxr-x  1 root  admin   996788 Mar  5  2020 libreadline.5.2.dylib
lrwxr-xr-x  1 root  admin       21 Dec  1  2020 libreadline.dylib -> libreadline.5.2.dylib
-rwxrwxr-x  1 root  admin    66864 Mar  5  2020 libunwind.1.dylib
[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% 
[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% echo ==== to be sure
==== to be sure
[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% cd /Library/Frameworks/R.framework/Resources
[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% pwd -P
/Library/Frameworks/R.framework/Versions/3.6/Resources
[Adams-MacBook-Pro-3:Frameworks/R.framework/Resources] adamsteel% 

Okay, this has me stumped and is probably irritating you as it lingers.
I will send you a PM (private message - see upper right of message board page) on meeting more substantially.

  • rick