R package fail

Hi all,

I tried to install AFNI. In the beginning, I couldn’t use R from the command so I installed the R again through Homebrew. R seems to work. However, I can’t install the R packages needed for AFNI programs. When I installed it, I got several warning messages as below. Thoughts? Thanks!

updating R_LD_LIBRARY_PATH …
Installing package into ‘/Users/amylo/Library/R/4.0/library’
(as ‘lib’ is unspecified)
Warning: dependency ‘cmdstanr’ is not available
also installing the dependencies ‘units’, ‘V8’, ‘gsl’, ‘sf’, ‘rstan’, ‘shinystan’, ‘rtdists’, ‘spdep’

trying URL ‘http://cloud.r-project.org/src/contrib/units_0.7-1.tar.gz
Content type ‘application/x-gzip’ length 854699 bytes (834 KB)

downloaded 834 KB

trying URL ‘http://cloud.r-project.org/src/contrib/V8_3.4.0.tar.gz
Content type ‘application/x-gzip’ length 682079 bytes (666 KB)

downloaded 666 KB

trying URL ‘http://cloud.r-project.org/src/contrib/gsl_2.1-6.tar.gz
Content type ‘application/x-gzip’ length 189794 bytes (185 KB)

downloaded 185 KB

trying URL ‘http://cloud.r-project.org/src/contrib/sf_0.9-8.tar.gz
Content type ‘application/x-gzip’ length 4213253 bytes (4.0 MB)

downloaded 4.0 MB

trying URL ‘http://cloud.r-project.org/src/contrib/rstan_2.21.2.tar.gz
Content type ‘application/x-gzip’ length 1152008 bytes (1.1 MB)

downloaded 1.1 MB

trying URL ‘http://cloud.r-project.org/src/contrib/shinystan_2.5.0.tar.gz
Content type ‘application/x-gzip’ length 2400413 bytes (2.3 MB)

downloaded 2.3 MB

trying URL ‘http://cloud.r-project.org/src/contrib/rtdists_0.11-2.tar.gz
Content type ‘application/x-gzip’ length 867210 bytes (846 KB)

downloaded 846 KB

trying URL ‘http://cloud.r-project.org/src/contrib/spdep_1.1-7.tar.gz
Content type ‘application/x-gzip’ length 4194093 bytes (4.0 MB)

downloaded 4.0 MB

trying URL ‘http://cloud.r-project.org/src/contrib/brms_2.15.0.tar.gz
Content type ‘application/x-gzip’ length 4343133 bytes (4.1 MB)

downloaded 4.1 MB

  • installing source package ‘units’ …
    ** package ‘units’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: units: 0.7-1
    checking whether the C++ compiler works… yes
    checking for C++ compiler default output file name… a.out
    checking for suffix of executables…
    checking whether we are cross compiling… no
    checking for suffix of object files… o
    checking whether we are using the GNU C++ compiler… yes
    checking whether clang++ -std=gnu++11 accepts -g… yes
    checking how to run the C++ preprocessor… clang++ -std=gnu++11 -E
    checking for grep that handles long lines and -e… /usr/bin/grep
    checking for egrep… /usr/bin/grep -E
    checking for ANSI C header files… rm: conftest.dSYM: is a directory
    rm: conftest.dSYM: is a directory
    yes
    checking for sys/types.h… yes
    checking for sys/stat.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for memory.h… yes
    checking for strings.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for unistd.h… yes
    checking for stdbool.h that conforms to C99… no
    checking for _Bool… no
    checking for error_at_line… no
    checking for gcc… clang
    checking whether we are using the GNU C compiler… yes
    checking whether clang accepts -g… yes
    checking for clang option to accept ISO C89… none needed
    checking for XML_ParserCreate in -lexpat… yes
    checking udunits2.h usability… no
    checking udunits2.h presence… no
    checking for udunits2.h… no
    checking udunits2/udunits2.h usability… no
    checking udunits2/udunits2.h presence… no
    checking for udunits2/udunits2.h… no
    checking for ut_read_xml in -ludunits2… no
    configure: error: in `/private/tmp/RtmpfhWJXv/R.INSTALL126f4457faa7/units’:
    configure: error:

Configuration failed because libudunits2.so was not found. Try installing:
* deb: libudunits2-dev (Debian, Ubuntu, …)
* rpm: udunits2-devel (Fedora, EPEL, …)
* brew: udunits (OSX)
If udunits2 is already installed in a non-standard location, use:
–configure-args=‘–with-udunits2-lib=/usr/local/lib’
if the library was not found, and/or:
–configure-args=‘–with-udunits2-include=/usr/include/udunits2’
if the header was not found, replacing paths with appropriate values.
You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.

See `config.log’ for more details
ERROR: configuration failed for package ‘units’

  • removing ‘/Users/amylo/Library/R/4.0/library/units’
  • installing source package ‘V8’ …
    ** package ‘V8’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Found C++14 compiler: clang++
    Using CXXCPP=clang++ -std=gnu++14 -E
    Using PKG_CFLAGS=-I/usr/local/opt/v8/include -I/usr/local/opt/v8/libexec/include
    Using PKG_LIBS=-L/usr/local/opt/v8/libexec -lv8 -lv8_libplatform
    -----------------------------[ ANTICONF ]-------------------------------
    Configuration failed to find the libv8 engine library. Try installing:
  • deb: libv8-dev or libnode-dev (Debian / Ubuntu)
  • rpm: v8-devel (Fedora, EPEL)
  • brew: v8 (OSX)
  • csw: libv8_dev (Solaris)
    Alternatively, on Linux (x86_64) or MacOS you can set environment variable:
    DOWNLOAD_STATIC_LIBV8=1
    to automatically download a static version of libv8.
    To use a custom libv8, set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars=‘INCLUDE_DIR=… LIB_DIR=…’
    ---------------------------[ ERROR MESSAGE ]----------------------------
    :1:10: fatal error: ‘v8.h’ file not found
    #include <v8.h>
    ^~~~~~
    1 error generated.

ERROR: configuration failed for package ‘V8’

  • removing ‘/Users/amylo/Library/R/4.0/library/V8’
  • installing source package ‘gsl’ …
    ** package ‘gsl’ successfully unpacked and MD5 sums checked
    ** using staged installation
    checking for gsl-config… no
    configure: error: gsl-config not found, is GSL installed?
    ERROR: configuration failed for package ‘gsl’
  • removing ‘/Users/amylo/Library/R/4.0/library/gsl’
    ERROR: dependency ‘units’ is not available for package ‘sf’
  • removing ‘/Users/amylo/Library/R/4.0/library/sf’
    ERROR: dependency ‘V8’ is not available for package ‘rstan’
  • removing ‘/Users/amylo/Library/R/4.0/library/rstan’
    ERROR: dependency ‘gsl’ is not available for package ‘rtdists’
  • removing ‘/Users/amylo/Library/R/4.0/library/rtdists’
    ERROR: dependency ‘rstan’ is not available for package ‘shinystan’
  • removing ‘/Users/amylo/Library/R/4.0/library/shinystan’
    ERROR: dependency ‘sf’ is not available for package ‘spdep’
  • removing ‘/Users/amylo/Library/R/4.0/library/spdep’
    ERROR: dependencies ‘rstan’, ‘shinystan’ are not available for package ‘brms’
  • removing ‘/Users/amylo/Library/R/4.0/library/brms’

The downloaded source packages are in
‘/private/tmp/RtmpWH5nFp/downloaded_packages’

++ Note: @ 15:36:30
This package has been installed on the computer: brms

Warning messages:
1: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘units’ had non-zero exit status
2: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘V8’ had non-zero exit status
3: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘gsl’ had non-zero exit status
4: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘sf’ had non-zero exit status
5: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘rstan’ had non-zero exit status
6: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘rtdists’ had non-zero exit status
7: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘shinystan’ had non-zero exit status
8: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘spdep’ had non-zero exit status
9: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘brms’ had non-zero exit status

Here comes the whole report from system check:

--------------------- AFNI and related program tests ---------------------
which afni : /Users/amylo/abin/afni
afni version : Precompiled binary macos_10.12_local: Apr 5 2021
: AFNI_21.1.00 ‘Domitian’
AFNI_version.txt : AFNI_21.1.00, macos_10.12_local, Apr 05 2021
which python : /usr/bin/python
python version : 2.7.16
which R : /usr/local/bin/R
R version : R version 4.0.5 (2021-03-31) – “Shake and Throw”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/amylo/abin/afni)
R : 1 (/usr/local/Cellar/r/4.0.5/bin/R)
python : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python2 : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python3 : 2
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
/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 : success

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

    oo Warning: 
       These packages are not installed on the computer: brms!

R RHOME : /usr/local/Cellar/r/4.0.5/lib/R

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 : /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.pyc

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

-------------------------------- env vars --------------------------------
PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/amylo/abin

PYTHONPATH =
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 : found AFNI_data6 under $HOME
top history: 20 Feb 2020 [rickr]: updated FT_analysis examples
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/amylo/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.8.0

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

– for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
** consider linking /usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/libgomp.1.dylib under /usr/local/lib
– 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 ‘tcsh’…
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace

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

  • missing R packages (see rPkgsInstall)

You can ignore the part related to ‘gsl’. However, it seems that you have some C++ compiler issue. You may need to update your XQuartz.

On a related note, some of R-related programs in AFNI currently do not work well with R version 4.0.x on Mac OS. One solution is to downgrade your R to 3.6.x. Or run those R-related programs on a Linux computer.