Error trying to run R-based group analysis programs

Hi afni gurus, I know you guys have Bootcamp this week. When you have a chance, I’ve been running into errors running the group analysis R programs.

Here is the output of my afni_system_check.py -check_all:

-------------------------------- general ---------------------------------
architecture: 64bit
cpu type: arm
system: Darwin
release: 22.5.0
version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
distribution: 13.4
number of CPUs: 10
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/sergiogarcia/abin/afni
afni version : Precompiled binary macos_13_ARM_clang: Jun 1 2023
: AFNI_23.1.07 'Publius Helvius Pertinax'
AFNI_version.txt : AFNI_23.1.07, macos_13_ARM_clang, Jun 01 2023
which python : /opt/homebrew/opt/python/libexec/bin/python
python version : 3.11.3
which R : /usr/local/bin/R
R version : R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/sergiogarcia/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
python : 1 (/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11)
python2 : 0
python3 : 2
/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11
/usr/bin/python3
Xvfb : 1 (/opt/X11/bin/Xvfb)

** have python3 but not python2

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/sergiogarcia/abin/R_io.so':
dlopen(/Users/sergiogarcia/abin/R_io.so, 0x0006): tried: '/Users/sergiogarcia/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/sergiogarcia/abin/R_io.so' (no such file), '/Users/sergiogarcia/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
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 -------------------------------
** failed to load module PyQt4
-- PyQt4 is no longer needed for an AFNI bootcamp

++ module loaded: matplotlib.pyplot
module file : /opt/homebrew/lib/python3.11/site-packages/matplotlib/pyplot.py
matplotlib version : 3.7.1

-------------------------------- env vars --------------------------------
PATH = /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/homebrew/opt/python/libexec/bin:/Library/Frameworks/R.framework/Resources:/usr/local/gfortran/bin:/Users/sergiogarcia/abin

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

----------------------------- eval dot files -----------------------------

-- good: .tcshrc seems to contain 'source .cshrc'
-- considered operations: path, flatdir, apsearch

-- note: followers should not need edits, so edit flags should be 0
(have 1 follower(s), which can be ignored)

no modifications needed across 3 dot files

------------------------------ 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/sergiogarcia/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.8.5

which brew : /opt/homebrew/bin/brew
brew version : Homebrew 4.0.20

-- for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
-- found 'libXt' dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
** env var DYLD_LIBRARY_PATH is not set to contain /opt/X11/lib/flat_namespace
(so afni and suma may fail)

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

  • just be aware: login shell 'zsh', but our code examples use 'tcsh'
  • AFNI programs show FAILURE
  • insufficient data for AFNI bootcamp
    (see "Prepare for Bootcamp" on install pages)
  • OS X version might be old
  • consider setting DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace

When I try to run 3dLMEr I get this error:

tcsh 3dLMEr_PUNK_PAiN_short.sh
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/sergiogarcia/abin/R_io.so':
dlopen(/Users/sergiogarcia/abin/R_io.so, 0x0006): tried: '/Users/sergiogarcia/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/sergiogarcia/abin/R_io.so' (no such file), '/Users/sergiogarcia/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted

Also just installed a version of R for my M1 chip to try to solve this, although it seems that I'm still getting the same error. Not sure if I installed it right.

Thanks!!

This error usually happens when you have the Intel (x86_64) version of R installed and do a compile on a computer with M1/M2 processors. Reinstalling R - specifically the amd64 version - and then doing another compile (build_afni.py) should fix the issue.

The key line in the error is:
mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')

I find it's generally a good idea to delete the existing R_io files before copying them over after a new build_afni.py is done.