AFNI R packages installation issue

Dear AFNI expert,

I was downloading afni and everything went smoothly but suddenly my internet connection crashed for some reason when I was running the R packages installation command.
Then when I’m going to run the following command:

rPkgsInstall -pkgs ALL

but I got the following message

  • installing source package ‘sf’ …
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config… no
    no
    configure: error: gdal-config not found or not executable.
    ERROR: configuration failed for package ‘sf’
  • removing ‘/home/davide/R/sf’
    ERROR: dependency ‘mvtnorm’ is not available for package ‘bridgesampling’
  • removing ‘/home/davide/R/bridgesampling’
    ERROR: dependency ‘sf’ is not available for package ‘spdep’
  • removing ‘/home/davide/R/spdep’
    ERROR: dependency ‘bridgesampling’ is not available for package ‘brms’
  • removing ‘/home/davide/R/brms’

The downloaded source packages are in
‘/tmp/RtmpVPe7O3/downloaded_packages’

++ Note: @ 13:26:22
This package has been installed on the computer: brms

Warning messages:
1: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘sf’ had non-zero exit status
2: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘bridgesampling’ had non-zero exit status
3: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘spdep’ had non-zero exit status
4: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘brms’ had non-zero exit status

Any tips?

Thanks

Dave

Hi, Davide-

It’s pretty hard to diagnose and remedy without more basic information about your system. Is it Mac or Linux (or Windows → Linux)? What version of R do you have? If you could provide the output of


afni_system_check.py -check_all

that would probably provide most of the useful information.

My guess is that you might have to update your version of R to 3.5.[something] to be able to get brms; we have seen that a lot lately with some Bootcamp preparation. As to the sf, I’m not sure, but perhaps it is a similar issue. Again, this is just a guess without more info.

–pt

Dear Paul,

please find the output of the command below:

-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 4.15.0-46-generic
version: #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019
distribution: Ubuntu 18.04 bionic
number of CPUs: 24
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/davide/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Mar 20 2019
: AFNI_19.0.26 ‘Tiberius’
AFNI_version.txt : AFNI_19.0.26, linux_ubuntu_16_64, Mar 20 2019
which python : /usr/bin/python
python version : 2.7.15rc1
which R : /usr/bin/R
R version : R version 3.4.4 (2018-03-15) – “Someone to Lean On”
which tcsh : /usr/bin/tcsh

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

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

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

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

checking for $HOME files…
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
++ module ‘PyQt4’ found at /usr/lib/python2.7/dist-packages/PyQt4
++ module loaded: PyQt4

-------------------------------- env vars --------------------------------
PATH = /usr/lib/afni/bin:/usr/local/fsl/bin:/usr/local/MATLAB/R2017a/bin:/home/davide/mrtrix3/bin:/usr/local/freesurfer/bin:/usr/local/freesurfer/fsfast/bin:/usr/local/freesurfer/tktools:/usr/local/fsl/bin:/usr/local/freesurfer/mni/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/davide/abin:/home/davide/abin

PYTHONPATH =
R_LIBS = /home/davide/R

LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

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

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

have Ubuntu system: Ubuntu 18.04 bionic
have Ubuntu afni : Precompiled binary linux_ubuntu_16_64: Mar 20 2019

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

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • shell bash: consider sourcing (non-login) .bashrc from (login) .profile
  • missing R packages (see rPkgsInstall)
  • insufficient data for AFNI bootcamp

Thanks again

Hi-

Okay, you can check out this thread for explicit instructions on how to update your R to 3.5.3 on Ubuntu 18.04 here:
https://afni.nimh.nih.gov/afni/community/board/read.php?1,160841,160868#msg-160868

Well, I guess I can repost the instructions here so they are in a single post:

Remove your current R:


sudo apt-get remove r-base-core

Add the following line to the bottom of your /etc/apt/sources.list file but also remove the underscores “_” as you do:


deb h_t_t_p_s_:_/_/cloud.r-project.org/bin/linux/ubuntu bionic-cran35

(I had to add the underscores for the forum post, just so it wouldn’t be tranlated to an abbreviated link). To open that file so that it is editable, you need to use sudo when calling your text editor; so, something like: “sudo gedit /etc/apt/sources.list” to open the file, then copy+paste that line, then remove the underscores; save+close that text file.

After that, run:


sudo apt-get update

so that the package manager can see the changes.

Then run:


sudo apt-get install -y r-base-dev

to install R, which should be some v3.5.* now.

Then, run this to try to reinstall necessary packages.


rPkgsInstall -pkgs ALL

Hi Paul

thanks for your help. I’ve followed your instruction but things doesn’t change (see below)

rPkgsInstall -pkgs ALL
Installing package into ‘/home/davide/R’
(as ‘lib’ is unspecified)
Warning: dependency ‘mvtnorm’ is not available
also installing the dependencies ‘sf’, ‘bridgesampling’, ‘spdep’

trying URL ‘http://cran.us.r-project.org/src/contrib/sf_0.7-3.tar.gz
Content type ‘application/x-gzip’ length 8166770 bytes (7.8 MB)

downloaded 7.8 MB

trying URL ‘http://cran.us.r-project.org/src/contrib/bridgesampling_0.6-0.tar.gz
Content type ‘application/x-gzip’ length 1186306 bytes (1.1 MB)

downloaded 1.1 MB

trying URL ‘http://cran.us.r-project.org/src/contrib/spdep_1.0-2.tar.gz
Content type ‘application/x-gzip’ length 1283061 bytes (1.2 MB)

downloaded 1.2 MB

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

downloaded 4.1 MB

  • installing source package ‘sf’ …
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config… no
    no
    configure: error: gdal-config not found or not executable.
    ERROR: configuration failed for package ‘sf’
  • removing ‘/home/davide/R/sf’
    ERROR: dependency ‘mvtnorm’ is not available for package ‘bridgesampling’
  • removing ‘/home/davide/R/bridgesampling’
    ERROR: dependency ‘sf’ is not available for package ‘spdep’
  • removing ‘/home/davide/R/spdep’
    ERROR: dependency ‘bridgesampling’ is not available for package ‘brms’
  • removing ‘/home/davide/R/brms’

The downloaded source packages are in
‘/tmp/RtmpidJQ7G/downloaded_packages’

++ Note: @ 18:34:02
This package has been installed on the computer: brms

Warning messages:
1: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘sf’ had non-zero exit status
2: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘bridgesampling’ had non-zero exit status
3: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘spdep’ had non-zero exit status
4: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘brms’ had non-zero exit status

Dave

Hi, Davide-

What is your output of


afni_system_check.py -check_all

now?

–pt

Paul,

please find attached the output

-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 4.15.0-46-generic
version: #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019
distribution: debian buster/sid
number of CPUs: 24
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/davide/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Mar 20 2019
: AFNI_19.0.26 ‘Tiberius’
AFNI_version.txt : AFNI_19.0.26, linux_ubuntu_16_64, Mar 20 2019
which python : /home/davide/anaconda3/bin/python
python version : 3.7.1
which R : /usr/bin/R
R version : R version 3.4.4 (2018-03-15) – “Someone to Lean On”
which tcsh : /usr/bin/tcsh

instances of various programs found in PATH:
afni : 1 (/home/davide/abin/afni)
R : 1 (/usr/bin/R)
python : 2
/home/davide/anaconda3/bin/python3.7
/usr/bin/python2.7
python2 : 1 (/usr/bin/python2.7)
python3 : 2
/home/davide/anaconda3/bin/python3.7
/usr/bin/python3.6

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

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

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

checking for $HOME files…
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
** python module not found: PyQt4
– PyQt4 is no longer needed for an AFNI bootcamp

-------------------------------- env vars --------------------------------
PATH = /home/davide/anaconda3/bin:/usr/lib/afni/bin:/usr/local/fsl/bin:/usr/local/MATLAB/R2017a/bin:/home/davide/mrtrix3/bin:/usr/local/freesurfer/bin:/usr/local/freesurfer/fsfast/bin:/usr/local/freesurfer/tktools:/usr/local/fsl/bin:/usr/local/freesurfer/mni/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/davide/abin:/home/davide/abin

PYTHONPATH =
R_LIBS = /home/davide/R

LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

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

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

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

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • have python version 3.7.1, some programs need 2.7.x
  • missing R packages (see rPkgsInstall)
  • insufficient data for AFNI bootcamp
  • consider running: apt-get install python-qt4

Hi, Davide-

From this line in it:


R version : R version 3.4.4 (2018-03-15) -- "Someone to Lean On"

it seems that the R version has not been updated.

To check on the package manager sources file and see if it has been updated OK, what is the output of:


grep bionic /etc/apt/sources.list

?

(Note: you can also check your version of R by just typing R on the command line and reading the first couple lines of header info there.)
–pt

#deb cdrom:[Ubuntu 18.04 LTS Bionic Beaver - Release amd64 (20180426)]/ bionic main restricted
deb http://ci.archive.ubuntu.com/ubuntu/ bionic main restricted

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic main restricted

deb http://ci.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

deb http://ci.archive.ubuntu.com/ubuntu/ bionic universe

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic universe

deb http://ci.archive.ubuntu.com/ubuntu/ bionic-updates universe

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic-updates universe

deb http://ci.archive.ubuntu.com/ubuntu/ bionic multiverse

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic multiverse

deb http://ci.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

deb http://ci.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://ci.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu bionic partner

deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted

deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted

deb http://security.ubuntu.com/ubuntu bionic-security universe

deb-src http://security.ubuntu.com/ubuntu bionic-security universe

deb http://security.ubuntu.com/ubuntu bionic-security multiverse

deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

deb https://cloud.r-project.org/bin/linux/ubuntu/ bionic-cran35/

Hi, Davide-

This may look like a small thing, but from this manual about deb source files here:
https://manpages.debian.org/jessie/apt/sources.list.5.en.html
… I wonder if you might need to remove the slash at the end of your “…r-project.org/bin/linux/ubuntu/” string in the /etc/apt/sources.list file? I don’t have that in mine, and it seems to suggest the blocks following it are treated differently (it might not matter; I’m a bit far from my Linux machine to be able to try it myself).

After that change, you could re-remove R again, and then do the “update” command, and then try to re-install R again. See if that gets you the modern version number?

–pt

Hi, Davide-

We have updated the installation of R on Ubuntu commands, and I think this will update/fix your R version. From here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_linux_ubuntu18.html#install-r

You can do this part:


curl -O [https://afni.nimh.nih.gov/pub/dist/src/scripts_src/@add_rcran_ubuntu_18.04.tcsh](https://afni.nimh.nih.gov/pub/dist/src/scripts_src/@add_rcran_ubuntu_18.04.tcsh)
sudo tcsh @add_rcran_ubuntu_18.04.tcsh

which should update your R version, as well as any currently installed R packages.

Then, you should be able to do this:


rPkgsInstall -pkgs ALL

and get everything installed.

Note: one or more of the above steps may take a while, as R compiles stuff on your computer.

You can check your R version wtih “R --version”, and check if AFNI has everything with:


afni_system_check.py -check_all

Hope that works.

–pt

Thanks Paul,

your script worked perfectly and solved all the issues with the R packages!

thank you so much for your help

Davide