Missing R packages

Hi,

It is my first time installing afni on M2 pro and I'm completely confused about how the path works. Before this, I have installed R and R studio on my Mac,

(1) Is it possible to link the afni setup to the R packages (e.g., afex, brms, car, etx.) that I have installed through R studio?
(2) Is it possible to use different version for Rstudio and afni? Currently, I am using v 4.3.1. But after I have installed afni, I'm using v. 3.6.3.

When I ran the afni_system_check.py -check-all, I received the following message.

-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             arm
system:               Darwin
release:              22.5.0
version:              Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020
distribution:         13.4.1
number of CPUs:       10
apparent login shell: zsh
shell RC file:        .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/meilingsoh/abin/afni
afni version         : Precompiled binary macos_10.12_local: Jun 29 2023 
                     : AFNI_23.1.10 'Publius Helvius Pertinax'
AFNI_version.txt     : AFNI_23.1.10, macos_10.12_local, Jun 29 2023, official
which python         : /opt/homebrew/opt/python/libexec/bin/python
python version       : 3.11.4
which R              : /usr/local/bin/R
R version            : R version 3.6.3 (2020-02-29) -- "Holding the Windsock"

instances of various programs found in PATH:
    afni    : 1   (/Users/meilingsoh/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/R)
    python  : 1   (/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11)
    python2 : 0 
    python3 : 2 
      /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11
      /usr/bin/python3

** have python3 but not python2

testing ability to start various programs...
    afni                 : success
    suma                 : success
    3dSkullStrip         : success
    3dAllineate          : success
    3dRSFC               : success
    SurfMesh             : success
    3dClustSim           : success
    uber_subject.py      : success
    3dMVM                : success

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh           : /bin/tcsh
which Xvfb           : /opt/X11/bin/Xvfb

checking for R packages...
    rPkgsInstall -pkgs ALL -check : FAILURE
        
        oo Warning: 
           These packages are not installed on the computer: afex!
        These packages are not installed on the computer: phia!
        These packages are not installed on the computer: paran!
        These packages are not installed on the computer: psych!
        These packages are not installed on the computer: brms!
        These packages are not installed on the computer: corrplot!
        These packages are not installed on the computer: metafor!
        

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

------------------------------ python libs -------------------------------

** failed to load module matplotlib.pyplot
-- matplotlib.pyplot is required

-------------------------------- env vars --------------------------------
PATH = /Users/meilingsoh/anaconda3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/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/meilingsoh/abin

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

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

----------- AFNI $HOME files -----------

    .afnirc                   : found
    .sumarc                   : found
    .afni/help/all_progs.COMP : found

--------- shell startup files ----------

   -- no .cshrc, will create one as a follower of .tcshrc
   -- 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)
   
   dot file test : want 1 modifications across 3 files:
   
      file             path  flatdir  apsearch        follower
      ---------------  ----  -------  --------        --------
      .cshrc           0     0        0               1     
      .tcshrc          0     0        1               0     
      .zshrc           0     0        0               0     
   
------------------------------ 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/meilingsoh/abin

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

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

-- consider installing gcc under homebrew
-- consider installing glib under homebrew
++ 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 'zsh'...
++ 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

=========================  summary, please fix:  =========================
*  just be aware: login shell 'zsh', but our code examples use 'tcsh'
*  missing R packages (see rPkgsInstall)
*  python library matplotlib is required
   (see AFNI install docs for details)
*  dot file test : want 1 modifications across 3 files:
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

Hi,

If you are using the newer R version with Rstudio, the libraries are compatible with the newer R version.
The older version of R being used with afni will have a separate location for the libraries.
So you do have to have 2 versions of the libraries...
We are close to having the afni binaries work with the newer R versions so you won't have that problem.

I am running the newest version of R with Rstudio and afni, but I have the afni binaries built on the same computer so it knows about the newer R version.

thanks, Justin

Thank you for the reply.

Update:

  • Managed to change it to the latest R version through R Studio but now the 3dMVM program does work. The error message is:
Error in dyn.load(ll) :
unable to load shared object '/Users/meilingsoh/abin/R_io.so':
dlopen(/Users/meilingsoh/abin/R_io.so, 0x0006): tried: '/Users/meilingsoh/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/meilingsoh/abin/R_io.so' (no such file), '/Users/meilingsoh/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

So, I looked into the R studio and if you were to download the R Studio and R from Chrome, the default pathway is Library/Frameworks/R Framework and not in the Users/user_name/.

  • Also, note that I installed homebrew by downloading it from Chrome too. So, brew install gcc doesn't work for me.

I just switched from Win to Mac this week, so will need time to figure out how things are stored but will update here again if I figure it out. It will be a fun ride.

-------------------------------- general ---------------------------------
architecture: 64bit
cpu type: arm
system: Darwin
release: 22.5.0
version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020
distribution: 13.4.1
number of CPUs: 10
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/meilingsoh/abin/afni
afni version : Precompiled binary macos_10.12_local: Jun 29 2023
: AFNI_23.1.10 'Publius Helvius Pertinax'
AFNI_version.txt : AFNI_23.1.10, macos_10.12_local, Jun 29 2023, official
which python : /opt/homebrew/opt/python/libexec/bin/python
python version : 3.11.4
which R : /usr/local/bin/R
R version : R version 4.3.1 (2023-06-16) -- "Beagle Scouts"

instances of various programs found in PATH:
afni : 1 (/Users/meilingsoh/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.4_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11)
python2 : 0
python3 : 2
/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11
/usr/bin/python3

** have python3 but not python2

testing ability to start various programs...
afni : success
suma : success
3dSkullStrip : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
uber_subject.py : success
3dMVM : FAILURE
Error in dyn.load(ll) :
unable to load shared object '/Users/meilingsoh/abin/R_io.so':
dlopen(/Users/meilingsoh/abin/R_io.so, 0x0006): tried: '/Users/meilingsoh/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/meilingsoh/abin/R_io.so' (no such file), '/Users/meilingsoh/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

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh : /bin/tcsh
which Xvfb : /opt/X11/bin/Xvfb

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

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

------------------------------ python libs -------------------------------

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

-------------------------------- 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:/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/meilingsoh/abin

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

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

----------- AFNI $HOME files -----------

.afnirc                   : found
.sumarc                   : found
.afni/help/all_progs.COMP : found

--------- shell startup 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)

dot file test : want 3 modifications across 3 files:

  file             path  flatdir  apsearch        follower
  ---------------  ----  -------  --------        --------
  .cshrc           1     1        1               0     
  .tcshrc          0     0        0               1     
  .zshrc           0     0        0               0     

------------------------------ data checks -------------------------------
data dir : found AFNI_data6 under $HOME (471482M Avail)
top history: ...3 [rickr]: renamed GroupAna_cases scripts and output
data dir : found AFNI_demos under $HOME
top history: ...ct 2020 [taylorp]: updated scripts under FATCAT_DEMO
data dir : found suma_demo under $HOME
top history: ...s_New/data/Build_tmp on Mon Mar 4 11:56:45 EST 2013
data dir : found afni_handouts under $HOME
atlas : found TT_N27+tlrc under /Users/meilingsoh/abin

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

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

++ 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 'zsh'...
++ 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

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

  • just be aware: login shell 'zsh', but our code examples use 'tcsh'
  • AFNI programs show FAILURE
  • dot file test : want 3 modifications across 3 files:
  • consider installing gcc under homebrew
  • consider installing glib under homebrew

That makes sense.
The R_io.so is built with the older R.
We are working on the newer version, but let me see if I can get something to you in the meantime.

For the record, there is a macos_12_x86_64 package available, which is built against R-4.2.3.

  • rick