Failed to install afex and phia in WSL Ubuntu 20.04

Hello afni experts, I am pretty new to afni and Unix system. I am trying to install afni on a WSL Ubuntu 20.04 system but the R installation is quite annoying. I tried to fix this problem as ohter post said on the forum but still not work.. So I am here to seek for some help. Thanks a lot!

peng@PENG-MSI:~$ Rscript -e "install.packages(c('Rcpp','brms'), dependencies = TRUE, INSTALL_opts = '--no-lock')"
Installing packages into ‘/home/peng/R’
(as ‘lib’ is unspecified)
Warning: dependency ‘cmdstanr’ is not available
also installing the dependencies ‘gsl’, ‘broom’, ‘tidyr’, ‘rtdists’, ‘mice’, ‘spdep’

trying URL 'https://cloud.r-project.org/src/contrib/gsl_2.1-8.tar.gz'
Content type 'application/x-gzip' length 217997 bytes (212 KB)
==================================================
downloaded 212 KB

trying URL 'https://cloud.r-project.org/src/contrib/broom_1.0.7.tar.gz'
Content type 'application/x-gzip' length 644384 bytes (629 KB)
==================================================
downloaded 629 KB

trying URL 'https://cloud.r-project.org/src/contrib/tidyr_1.3.1.tar.gz'
Content type 'application/x-gzip' length 809058 bytes (790 KB)
==================================================
downloaded 790 KB

trying URL 'https://cloud.r-project.org/src/contrib/rtdists_0.11-5.tar.gz'
Content type 'application/x-gzip' length 532264 bytes (519 KB)
==================================================
downloaded 519 KB

trying URL 'https://cloud.r-project.org/src/contrib/mice_3.16.0.tar.gz'
Content type 'application/x-gzip' length 600498 bytes (586 KB)
==================================================
downloaded 586 KB

trying URL 'https://cloud.r-project.org/src/contrib/spdep_1.3-6.tar.gz'
Content type 'application/x-gzip' length 4658588 bytes (4.4 MB)
==================================================
downloaded 4.4 MB

trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_1.0.13.tar.gz'
Content type 'application/x-gzip' length 3435344 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

trying URL 'https://cloud.r-project.org/src/contrib/brms_2.22.0.tar.gz'
Content type 'application/x-gzip' length 4965722 bytes (4.7 MB)
==================================================
downloaded 4.7 MB

* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
checking for gcc... gcc
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 the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/home/peng/R/gsl’
* installing *source* package ‘tidyr’ ...
** package ‘tidyr’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG  -I'/home/peng/R/cpp11/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c cpp11.cpp -o cpp11.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG  -I'/home/peng/R/cpp11/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c melt.cpp -o melt.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG  -I'/home/peng/R/cpp11/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c simplifyPieces.cpp -o simplifyPieces.o
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o tidyr.so cpp11.o melt.o simplifyPieces.o -L/usr/lib/R/lib -lR
installing to /home/peng/R/tidyr/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Warning: S3 methods ‘as_mapper.character’, ‘as_mapper.default’, ‘as_mapper.list’, ‘as_mapper.numeric’, ‘print.purrr_function_compose’, ‘print.purrr_function_partial’, ‘print.purrr_rate_backoff’, ‘print.purrr_rate_delay’, ‘rate_sleep.purrr_rate_backoff’, ‘rate_sleep.purrr_rate_delay’ were declared in NAMESPACE but not found
Error in library.dynam(lib, package, package.lib) : 
  shared object ‘purrr.so’ not found
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace -> library.dynam
Execution halted
ERROR: lazy loading failed for package ‘tidyr’
* removing ‘/home/peng/R/tidyr’
* installing *source* package ‘spdep’ ...
** package ‘spdep’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
** libs
using C compiler: ‘gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c card.c -o card.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c dfs_ncomp.c -o dfs_ncomp.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c dnn.c -o dnn.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c gabriel.c -o gabriel.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c gearyw.c -o gearyw.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c gsymtest.c -o gsymtest.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c init.c -o init.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c insiders.c -o insiders.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c jc.c -o jc.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c knn.c -o knn.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c lagw.c -o lagw.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c listw2sn.c -o listw2sn.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c nbdists.c -o nbdists.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c perm_no_replace.c -o perm_no_replace.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c polypoly.c -o polypoly.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c relative.c -o relative.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c skater.c -o skater.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c symtest.c -o symtest.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o spdep.so card.o dfs_ncomp.o dnn.o gabriel.o gearyw.o gsymtest.o init.o insiders.o jc.o knn.o lagw.o listw2sn.o nbdists.o perm_no_replace.o polypoly.o relative.o skater.o symtest.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/peng/R/spdep/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for ‘sf’ in library.dynam(lib, package, package.lib):
 shared object ‘sf.so’ not found
In addition: Warning message:
S3 methods ‘$.bbox’, ‘$.crs’, ‘$.m_range’, ‘$.z_range’, ‘$<-.sf’, ‘[.sf’, ‘[.sfc’, ‘[<-.sf’, ‘[<-.sfc’, ‘[[<-.sf’, ‘st_agr<-.sf’, ‘st_crs<-.bbox’, ‘st_crs<-.sf’, ‘st_crs<-.sfc’, ‘st_geometry<-.data.frame’, ‘st_geometry<-.sf’, ‘Ops.crs’, ‘Ops.sfc’, ‘Ops.sfg’, ‘Ops.sgbp’, ‘aggregate.sf’, ‘as.data.frame.sf’, ‘as.data.frame.sfc’, ‘as.data.frame.sgbp’, ‘as.matrix.sfg’, ‘as.matrix.sgbp’, ‘c.sfc’, ‘c.sfg’, ‘cbind.sf’, ‘dim.sgbp’, ‘duplicated.sf’, ‘format.bbox’, ‘format.crs’, ‘format.sfc’, ‘format.sfg’, ‘head.sfg’, ‘identify.sf’, ‘identify.sfc’, ‘is.na.bbox’, ‘is.na.crs’, ‘is.na.m_range’, ‘is.na.z_range’, ‘is_geometry_column.PqConnection’, ‘is_geometry_column.default’, ‘merge.sf’, ‘plot.sf’, ‘plot.sfc_CIRCULARSTRING’, ‘plot.sfc_GEOMETRY’, ‘plot.sfc_GEOMETRYCOLLECTION’, ‘plot.sfc_LINESTRING’, ‘pl [... truncated] 
Execution halted
ERROR: lazy loading failed for package ‘spdep’
* removing ‘/home/peng/R/spdep’
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c api.cpp -o api.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c attributes.cpp -o attributes.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c barrier.cpp -o barrier.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c date.cpp -o date.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c module.cpp -o module.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c rcpp_init.cpp -o rcpp_init.o
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -L/usr/lib/R/lib -lR
installing to /home/peng/R/Rcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (Rcpp)
ERROR: dependency ‘tidyr’ is not available for package ‘broom’
* removing ‘/home/peng/R/broom’
ERROR: dependency ‘gsl’ is not available for package ‘rtdists’
* removing ‘/home/peng/R/rtdists’
* installing *source* package ‘brms’ ...
** package ‘brms’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (brms)
ERROR: dependencies ‘broom’, ‘tidyr’ are not available for package ‘mice’
* removing ‘/home/peng/R/mice’

The downloaded source packages are in
	‘/tmp/RtmpP91s90/downloaded_packages’
Warning messages:
1: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘gsl’ had non-zero exit status
2: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘tidyr’ had non-zero exit status
3: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘spdep’ had non-zero exit status
4: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘broom’ had non-zero exit status
5: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘rtdists’ had non-zero exit status
6: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘mice’ had non-zero exit status
peng@PENG-MSI:~$ afni_system_check.py  -check_all
-------------------------------- general ---------------------------------
architecture:         64bit ELF
cpu type:             x86_64
system:               Linux
release:              4.4.0-19041-Microsoft
version:              #4355-Microsoft Thu Apr 12 17:37:00 PST 2024
distribution:         ubuntu 20.04 focal
number of CPUs:       12
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /home/peng/abin/afni
afni version         : Precompiled binary linux_ubuntu_16_64: Oct  1 2024 
                     : AFNI_24.3.00 'Elagabalus'
AFNI_version.txt     : AFNI_24.3.00, linux_ubuntu_16_64, Oct 01 2024, official
which python         : /usr/bin/python
python version       : 3.8.10
which R              : /usr/bin/R
R version            : R version 4.4.1 (x86_64-pc-linux-gnu)

instances of various programs found in PATH:
    afni    : 1   (/home/peng/abin/afni)
    R       : 1   (/usr/bin/R)
    python  : 1   (/usr/bin/python3.8)
    python2 : 0 
    python3 : 1   (/usr/bin/python3.8)

** 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           : /usr/bin/tcsh
tcsh version         : 6.21.00
which Xvfb           : /usr/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!
        

R RHOME : /usr/lib/R

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

++ module loaded: matplotlib.pyplot
   module file : /usr/lib/python3/dist-packages/matplotlib/pyplot.py
   matplotlib version : 3.1.2
** matplotlib version 3.1.2 cannot write jpeg images


++ module loaded: flask
   module file : /usr/lib/python3/dist-packages/flask/__init__.py
   flask version : 1.1.1

++ module loaded: flask_cors
   module file : /usr/lib/python3/dist-packages/flask_cors/__init__.py
   flask_cors version : 3.0.8

-------------------------------- env vars --------------------------------
PATH                       = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04LTS_2004.6.16.0_x64__79rhkp1fndgsc:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/e/Matlab_R2021a/runtime/win64:/mnt/e/Matlab_R2021a/bin:/mnt/e/Matlab_R2021a/polyspace/bin:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Users/A/AppData/Local/Microsoft/WindowsApps:/mnt/e/pycharm/PyCharm 2022.2.3/bin:/mnt/d/Anaconda:/mnt/d/Anaconda/Scripts:/mnt/d/Anaconda/Library/bin:/mnt/d/Anaconda/Library/mingw-w64/bin:/mnt/e/Mysql/bin:/mnt/c/Users/A/.dotnet/tools:/mnt/e/CLion/CLion 2023.1.4/bin:/mnt/d/Qt/6.2.4/mingw_64/bin:/mnt/d/Qt/6.2.4/mingw_64/lib:/mnt/d/Qt/Tools/mingw1120_64/bin:/mnt/d/Qt/Tools/mingw1120_64/lib:/snap/bin:/home/peng/abin

PYTHONPATH                 = 
R_LIBS                     = /home/peng/R
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH          = 
DYLD_FALLBACK_LIBRARY_PATH = 
CONDA_SHLVL                = 
CONDA_DEFAULT_ENV          = 
CC                         = 

----------------------------- 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, 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        1               0     
      .tcshrc          0     0        0               1     
      .bashrc          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 /home/peng/abin

------------------------------ OS specific -------------------------------
which apt-get        : /usr/bin/apt-get
apt-get version      : apt 2.0.10 (amd64)

have Ubuntu system: ubuntu 20.04 focal
have Ubuntu afni  : Precompiled binary linux_ubuntu_16_64: Oct  1 2024 

=========================  summary, please fix:  =========================
*  just be aware: login shell 'bash', but our code examples use 'tcsh'
*  missing R packages (see rPkgsInstall)
*  matplotlib version 3.1.2 cannot write jpeg images
*  dot file test : want 1 modifications across 3 files:
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

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!

Can you try the direct install within R, which surprisingly sometimes works better for certain packages? First, start R the R environment:

R

Then, do:

install.packages("afex")
install.packages("phia")

?

--pt

If it fails again, perhaps you need the libgsl-dev package installed:

sudo apt-get install libgsl-dev

It does not appear in one of the ubuntu 20 install instructions (but it is in another), and I don't know if it gets automatically installed as a prerequisite of something else.

  • rick

Thanks for reply. I tried this way but still can't install. The reports are shown below

peng@PENG-MSI:~$ R

R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> install.packages('afex')
Installing package into ‘/home/peng/R’
(as ‘lib’ is unspecified)
also installing the dependencies ‘tidyr’, ‘modelr’, ‘broom’, ‘doBy’, ‘pbkrtest’, ‘car’

trying URL 'https://cloud.r-project.org/src/contrib/tidyr_1.3.1.tar.gz'
Content type 'application/x-gzip' length 809058 bytes (790 KB)
==================================================
downloaded 790 KB

trying URL 'https://cloud.r-project.org/src/contrib/modelr_0.1.11.tar.gz'
Content type 'application/x-gzip' length 121480 bytes (118 KB)
==================================================
downloaded 118 KB

trying URL 'https://cloud.r-project.org/src/contrib/broom_1.0.7.tar.gz'
Content type 'application/x-gzip' length 644384 bytes (629 KB)
==================================================
downloaded 629 KB

trying URL 'https://cloud.r-project.org/src/contrib/doBy_4.6.24.tar.gz'
Content type 'application/x-gzip' length 4557394 bytes (4.3 MB)
==================================================
downloaded 4.3 MB

trying URL 'https://cloud.r-project.org/src/contrib/pbkrtest_0.5.3.tar.gz'
Content type 'application/x-gzip' length 59013 bytes (57 KB)
==================================================
downloaded 57 KB

trying URL 'https://cloud.r-project.org/src/contrib/car_3.1-3.tar.gz'
Content type 'application/x-gzip' length 384407 bytes (375 KB)
==================================================
downloaded 375 KB

trying URL 'https://cloud.r-project.org/src/contrib/afex_1.4-1.tar.gz'
Content type 'application/x-gzip' length 3326796 bytes (3.2 MB)
==================================================
downloaded 3.2 MB

* installing *source* package ‘tidyr’ ...
** package ‘tidyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG  -I'/home/peng/R/cpp11/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c cpp11.cpp -o cpp11.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG  -I'/home/peng/R/cpp11/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c melt.cpp -o melt.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG  -I'/home/peng/R/cpp11/include'     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-thBIeW/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c simplifyPieces.cpp -o simplifyPieces.o
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o tidyr.so cpp11.o melt.o simplifyPieces.o -L/usr/lib/R/lib -lR
installing to /home/peng/R/00LOCK-tidyr/00new/tidyr/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Warning: S3 methods ‘as_mapper.character’, ‘as_mapper.default’, ‘as_mapper.list’, ‘as_mapper.numeric’, ‘print.purrr_function_compose’, ‘print.purrr_function_partial’, ‘print.purrr_rate_backoff’, ‘print.purrr_rate_delay’, ‘rate_sleep.purrr_rate_backoff’, ‘rate_sleep.purrr_rate_delay’ were declared in NAMESPACE but not found
Error in library.dynam(lib, package, package.lib) : 
  shared object ‘purrr.so’ not found
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace -> library.dynam
Execution halted
ERROR: lazy loading failed for package ‘tidyr’
* removing ‘/home/peng/R/tidyr’
ERROR: dependency ‘tidyr’ is not available for package ‘broom’
* removing ‘/home/peng/R/broom’
ERROR: dependencies ‘broom’, ‘tidyr’ are not available for package ‘modelr’
* removing ‘/home/peng/R/modelr’
ERROR: dependencies ‘broom’, ‘modelr’, ‘tidyr’ are not available for package ‘doBy’
* removing ‘/home/peng/R/doBy’
ERROR: dependencies ‘broom’, ‘doBy’ are not available for package ‘pbkrtest’
* removing ‘/home/peng/R/pbkrtest’
ERROR: dependency ‘pbkrtest’ is not available for package ‘car’
* removing ‘/home/peng/R/car’
ERROR: dependencies ‘pbkrtest’, ‘car’ are not available for package ‘afex’
* removing ‘/home/peng/R/afex’

The downloaded source packages are in
	‘/tmp/RtmppTKzr2/downloaded_packages’
Warning messages:
1: In install.packages("afex") :
  installation of package ‘tidyr’ had non-zero exit status
2: In install.packages("afex") :
  installation of package ‘broom’ had non-zero exit status
3: In install.packages("afex") :
  installation of package ‘modelr’ had non-zero exit status
4: In install.packages("afex") :
  installation of package ‘doBy’ had non-zero exit status
5: In install.packages("afex") :
  installation of package ‘pbkrtest’ had non-zero exit status
6: In install.packages("afex") :
  installation of package ‘car’ had non-zero exit status
7: In install.packages("afex") :
  installation of package ‘afex’ had non-zero exit status

Thanks rick ! But still not good after running your command.. The state seems remain the same.

peng@PENG-MSI:~$ afni_system_check.py  -check_all
-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             x86_64
system:               Linux
release:              4.4.0-19041-Microsoft
version:              #4355-Microsoft Thu Apr 12 17:37:00 PST 2024
distribution:         Ubuntu 20.04 focal
number of CPUs:       12
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /home/peng/abin/afni
afni version         : Precompiled binary linux_ubuntu_16_64: Oct  1 2024 
                     : AFNI_24.3.00 'Elagabalus'
AFNI_version.txt     : AFNI_24.3.00, linux_ubuntu_16_64, Oct 01 2024, official
which python         : /usr/bin/python
python version       : 2.7.18
which R              : /usr/bin/R
R version            : R version 4.4.1 (x86_64-pc-linux-gnu)

instances of various programs found in PATH:
    afni    : 1   (/home/peng/abin/afni)
    R       : 1   (/usr/bin/R)
    python  : 1   (/usr/bin/python2.7)
    python2 : 1   (/usr/bin/python2.7)
    python3 : 1   (/usr/bin/python3.8)


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           : /usr/bin/tcsh
tcsh version         : 6.21.00
which Xvfb           : /usr/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!
        

R RHOME : /usr/lib/R

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

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

** failed to load module flask
-- flask is not required, but is desirable

** failed to load module flask_cors
-- flask_cors is not required, but is desirable

-------------------------------- env vars --------------------------------
PATH                       = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04LTS_2004.6.16.0_x64__79rhkp1fndgsc:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/e/Matlab_R2021a/runtime/win64:/mnt/e/Matlab_R2021a/bin:/mnt/e/Matlab_R2021a/polyspace/bin:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Users/A/AppData/Local/Microsoft/WindowsApps:/mnt/e/pycharm/PyCharm 2022.2.3/bin:/mnt/d/Anaconda:/mnt/d/Anaconda/Scripts:/mnt/d/Anaconda/Library/bin:/mnt/d/Anaconda/Library/mingw-w64/bin:/mnt/e/Mysql/bin:/mnt/c/Users/A/.dotnet/tools:/mnt/e/CLion/CLion 2023.1.4/bin:/mnt/d/Qt/6.2.4/mingw_64/bin:/mnt/d/Qt/6.2.4/mingw_64/lib:/mnt/d/Qt/Tools/mingw1120_64/bin:/mnt/d/Qt/Tools/mingw1120_64/lib:/snap/bin:/home/peng/abin:/home/peng/abin

PYTHONPATH                 = 
R_LIBS                     = /home/peng/R
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH          = 
DYLD_FALLBACK_LIBRARY_PATH = 
CONDA_SHLVL                = 
CONDA_DEFAULT_ENV          = 
CC                         = 

----------------------------- 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, 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
      ---------------  ----  -------  --------        --------
      .tcshrc          0     0        0               1     
      .cshrc           0     0        1               0     
      .bashrc          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 /home/peng/abin

------------------------------ OS specific -------------------------------
which apt-get        : /usr/bin/apt-get
apt-get version      : apt 2.0.10 (amd64)

have Ubuntu system: Ubuntu 20.04 focal
have Ubuntu afni  : Precompiled binary linux_ubuntu_16_64: Oct  1 2024 

=========================  summary, please fix:  =========================
*  just be aware: login shell 'bash', 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)

Hello,
I just meant that after running this to install the needed gsl library:
sudo apt-get install libgsl-dev
you should then go back and run:

rPkgsInstall -pkgs ALL

The installation that you tried directly from R might require an option to also install dependencies (like the purrr package that it reports). But since you should now have the needed gsl library installed, try running that rPkgsInstall command again.

Oh, and for the record, the dependencies option to include would be dependencies = TRUE, as in: install.packages("afex", dependencies = TRUE). But still, it should hopefully be enough to use rPkgsInstall.

  • rick