AFNI Installation Failed on WSL

Hi, does anybody know how to solve the following problems?

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

  • just be aware: login shell 'bash', but our code examples use 'tcsh'
  • AFNI programs show FAILURE
  • missing R packages (see rPkgsInstall)
  • please run: "suma -update_env" for .sumarc
  • dot file test : want 1 modifications across 3 files:

According to the Please fix, I rerun "rPkgsInstall -pkgs ALL" many times, but it doesn't solve the problem. It seems that r packages are installed under ''/home/Laura1/R'' not ''/usr/lib/R''. I don't know whether it is the cause of this problem.

When I run"suma -update_env", I got
sh: 1: cannot create ___sumarc: Permission denied
-- Error suma (SUMA_suma.c:743):
Failed to create env file.

More, I don't know how to deal with the last problem

This is full ASC.txt
-------------------------------- general ---------------------------------
architecture: 64bit ELF
cpu type: x86_64
system: Linux
release: 4.4.0-19041-Microsoft
version: #3996-Microsoft Thu Jan 18 16:36:00 PST 2024
distribution: ubuntu 20.04 focal
number of CPUs: 16
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/Laura1/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Mar 5 2024
: AFNI_24.0.10 'Caracalla'
AFNI_version.txt : AFNI_24.0.10, linux_ubuntu_16_64, Mar 05 2024, official
which python : /usr/bin/python
python version : 3.8.10
which R : /usr/bin/R
R version : R version 4.3.3 (x86_64-pc-linux-gnu)

instances of various programs found in PATH:
afni : 1 (/home/Laura1/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 : FAILURE
Error in library(data.table) : there is no package called ‘data.table’
Calls: source ... suppressPackageStartupMessages -> withCallingHandlers -> library
Execution halted

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

which tcsh : /usr/bin/tcsh
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!
    These packages are not installed on the computer: snow!
    These packages are not installed on the computer: lme4!
    These packages are not installed on the computer: lmerTest!
    These packages are not installed on the computer: gamm4!
    These packages are not installed on the computer: data.table!
    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 : /usr/lib/R

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

++ module loaded: matplotlib.pyplot
module file : /home/Laura1/.local/lib/python3.8/site-packages/matplotlib/pyplot.py
matplotlib version : 3.7.5

++ 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:/snap/bin:/home/Laura1/abin

PYTHONPATH =
R_LIBS = /home/Laura1/R
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =
CONDA_SHLVL =
CONDA_DEFAULT_ENV =

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

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

.afnirc                   : found
.sumarc                   : missing
.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 : found AFNI_data6 under $HOME (487697M Avail)
top history: ... [gangc]: redo 0.BGA as 1.bga and update run.MSS.txt
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 /home/Laura1/abin

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

have Ubuntu system: ubuntu 20.04 focal
have Ubuntu afni : Precompiled binary linux_ubuntu_16_64: Mar 5 2024

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

  • just be aware: login shell 'bash', but our code examples use 'tcsh'
  • AFNI programs show FAILURE
  • missing R packages (see rPkgsInstall)
  • please run: "suma -update_env" for .sumarc
  • dot file test : want 1 modifications across 3 files:

Howdy-

What is the output of:

ls -ld ~/R

and of:

ls -l ~/R

?

--pt

Thanks for ur reply!

The output of "ls -ld ~/R" is:
drwxrwxr-x 1 Laura1 Laura1 4096 Mar 9 12:08 /home/Laura1/R

The output of "ls -l ~/R" is:
total 0

Hello,

Let's be positive that you are in the home directory (or anywhere that you have write permissions to), running the suma and R update commands from there:

cd
suma -update_env
rPkgsInstall -pkgs ALL 2>&1 | tee out.rpkgsinstall.txt

What does that show?

Thanks,

  • rick

Hi, thanks for the reply!

The output of "suma -update_env" is:
++ Notice suma (SUMA_suma.c:756 @22:30:19):
Environment update done.

The output of "rPkgsInstall -pkgs ALL 2>&1 | tee out.rpkgsinstall.txt" is too big that I cannot paste it directly. Is there any way for me to upload the full file?

Regards,
Laury

Hi Laury,

Well it is encouraging that suma worked and that the file is big. So you might have just been in a bad directory to run the previous commands from. How about just re-posting the system check output:

afni_system_check.py -check_all

Thanks,

  • rick

Hi rick,

It works!:D, but it still have some problems with brms

The result is:
-------------------------------- general ---------------------------------
architecture: 64bit ELF
cpu type: x86_64
system: Linux
release: 4.4.0-19041-Microsoft
version: #3996-Microsoft Thu Jan 18 16:36:00 PST 2024
distribution: ubuntu 20.04 focal
number of CPUs: 16
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/Laura1/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Mar 5 2024
: AFNI_24.0.10 'Caracalla'
AFNI_version.txt : AFNI_24.0.10, linux_ubuntu_16_64, Mar 05 2024, official
which python : /usr/bin/python
python version : 3.8.10
which R : /usr/bin/R
R version : R version 4.3.3 (x86_64-pc-linux-gnu)

instances of various programs found in PATH:
afni : 1 (/home/Laura1/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
which Xvfb : /usr/bin/Xvfb

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

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

R RHOME : /usr/lib/R

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

++ module loaded: matplotlib.pyplot
module file : /home/Laura1/.local/lib/python3.8/site-packages/matplotlib/pyplot.py
matplotlib version : 3.7.5

++ 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:/snap/bin:/home/Laura1/abin

PYTHONPATH =
R_LIBS = /home/Laura1/R
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =
CONDA_SHLVL =
CONDA_DEFAULT_ENV =

----------------------------- 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 : found AFNI_data6 under $HOME (487697M Avail)
top history: ... [gangc]: redo 0.BGA as 1.bga and update run.MSS.txt
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 /home/Laura1/abin

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

have Ubuntu system: ubuntu 20.04 focal
have Ubuntu afni : Precompiled binary linux_ubuntu_16_64: Mar 5 2024

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

  • just be aware: login shell 'bash', but our code examples use 'tcsh'
  • missing R packages (see rPkgsInstall)
  • dot file test : want 1 modifications across 3 files:

Regards,
Laury

Hi Laury,

Great! I will send you a private message for where to mail the output from compiling the R packages, to see what it says about brms.

Thanks,

  • rick

For "brms" on Ubuntu 20.04, there is a note on the R install part to try this separately:

Rscript -e "install.packages(c('Rcpp','brms'), dependencies = TRUE, INSTALL_opts = '--no-lock')"

Can copy+paste that, and see if that works?

--pt

Indeed, there were no errors for brms in the log file.

Hopefully Paul's suggestion resolves it.

  • rick

Hi ptaylor,

I rerun the command, but it did not change anything. afni_system_check still showed the same thing.

This is outcome of the brms command:

Laura1@DESKTOP-LE5IUF8:~$  Rscript -e "install.packages(c('Rcpp','brms'), dependencies = TRUE, INSTALL_opts = '--no-lock')" > out.brm.txt
Installing packages into ‘/home/Laura1/R’
(as ‘lib’ is unspecified)
Warning: dependency ‘cmdstanr’ is not available
also installing the dependencies ‘igraph’, ‘threejs’, ‘gsl’, ‘shinystan’, ‘rtdists’

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

trying URL 'https://cloud.r-project.org/src/contrib/threejs_0.3.3.tar.gz'
Content type 'application/x-gzip' length 866293 bytes (845 KB)
==================================================
downloaded 845 KB

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/shinystan_2.6.0.tar.gz'
Content type 'application/x-gzip' length 2399890 bytes (2.3 MB)
==================================================
downloaded 2.3 MB

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/Rcpp_1.0.12.tar.gz'
Content type 'application/x-gzip' length 3430494 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

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

* installing *source* package ‘igraph’ ...
** package ‘igraph’ 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’
using C++ compiler: ‘g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
In file included from vendor/cigraph/src/community/optimal_modularity.c:32:
vendor/cigraph/src/internal/glpk_support.h:39:10: fatal error: glpk.h: No such file or directory
   39 | #include <glpk.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:191: vendor/cigraph/src/community/optimal_modularity.o] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/Laura1/R/igraph’
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
staged installation is only possible with locking
** using non-staged installation
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/home/Laura1/R/gsl’
* 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’
installing to /home/Laura1/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 ‘igraph’ is not available for package ‘threejs’
* removing ‘/home/Laura1/R/threejs’
ERROR: dependency ‘gsl’ is not available for package ‘rtdists’
* removing ‘/home/Laura1/R/rtdists’
ERROR: dependency ‘threejs’ is not available for package ‘shinystan’
* removing ‘/home/Laura1/R/shinystan’
ERROR: dependency ‘shinystan’ is not available for package ‘brms’
* removing ‘/home/Laura1/R/brms’

The downloaded source packages are in
        ‘/tmp/RtmpB3GL4p/downloaded_packages’
Warning messages:
1: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘igraph’ had non-zero exit status
2: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘gsl’ had non-zero exit status
3: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘threejs’ had non-zero exit status
4: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘rtdists’ had non-zero exit status
5: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘shinystan’ had non-zero exit status
6: In install.packages(c("Rcpp", "brms"), dependencies = TRUE, INSTALL_opts = "--no-lock") :
  installation of package ‘brms’ had non-zero exit status

Regards,
Laury

Hi, Laury-

Ah, I see. Ubuntu 20.04 was still a bit of a hard time for R dependencies. The default package manager repository locations didn't have all the necessary dependencies for "brms". Can you please try running this to add in more locations for the manager to be able to draw from:

sudo add-apt-repository universe
sudo add-apt-repository -y "ppa:marutter/rrutter4.0"
sudo add-apt-repository -y "ppa:c2d4u.team/c2d4u4.0+"

... and then try rerunning:

Rscript -e "install.packages(c('Rcpp','brms'), dependencies = TRUE, INSTALL_opts = '--no-lock')"

?

thanks,
pt

Hi ptaylor,

I ran all the commands, but the result of afni_system_check remains the same. The outcome of the brms command seems to remain the same as well.

Regards,
Laury

Hi Laury,

Note that perhaps you really do not need brms. If that proves very problematic on that particular system, you might be fine proceeding without it. That is used in some of @Gang's group analysis programs, though I do not recall which.

  • rick

Hi rick,

Thanks for ur patience! Your suggestions help me a lot:)

But I got some new problems, could u help me with that?
Afni and suma cannot display properly.

Precompiled binary linux_ubuntu_16_64: Mar  5 2024 (Version AFNI_24.0.10 'Caracalla')


** Version check disabled: AFNI_VERSION_CHECK forbids
Thanks go to W Gaggl for many suggestions

Initializing: X11Error: Can't open display:
++ AFNI is detached from terminal.
suma:
     No input specified, loading some toy surfaces...
     Use '.' and ',' to cycle between them.
     See suma -help for assistance.

Error: Can't open display:

Thanks,
Laury

Hi, Laury-

This looks like more of the Windows/server side of things. Did you set up, like VcXsrv on Windows, and start it before you opened the Ubuntu terminal, as described here? There are a couple commands to copy+paste in the terminal, too, that should help.

--pt

Hi ptaylor,

It works:D, it seems that I forgot to restart the terminal for those changes.
Thanks for your patience! It helps a lot!

Best,
Laury

Sure thing, glad that worked.

There are a lot of steps to this stuff, esp. with Windows.

--pt