Bash/tcsh and missing R packages when installing AFNI

Good weekend, everyone,

Thank you in advance, my dear in the AFNI community,
I am new to AFNI and can not figure out what’s going on when installing AFNI.

errors come out as follows (also see attached file please),

  1. installing the R

Reading package lists… Done
Building dependency tree
Reading state information… Done
r-base-dev is already the newest version (3.4.4-1ubuntu1).
r-cran-rmpi is already the newest version (0.6-6-4build1).
0 upgraded, 0 newly installed, 0 to remove and 313 not upgraded.

  1. rPkgsInstall -pkgs ALL

[i]Installing package into ‘/home/golbylab/R’
(as ‘lib’ is unspecified)
Warning: dependency ‘mvtnorm’ is not available
also installing the dependencies ‘units’, ‘sf’, ‘bridgesampling’, ‘spdep’

trying URL ‘http://cran.us.r-project.org/src/contrib/units_0.6-2.tar.gz
Content type ‘application/x-gzip’ length 917316 bytes (895 KB)

downloaded 895 KB

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 ‘units’ …
    ** package ‘units’ successfully unpacked and MD5 sums checked
    configure: units: 0.6-2
    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 g++ accepts -g… yes
    checking how to run the C++ preprocessor… g++ -E
    checking for grep that handles long lines and -e… /bin/grep
    checking for egrep… /bin/grep -E
    checking for ANSI C header files… 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… yes
    checking for gcc… gcc -std=gnu99
    checking whether we are using the GNU C compiler… yes
    checking whether gcc -std=gnu99 accepts -g… yes
    checking for gcc -std=gnu99 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 `/tmp/Rtmppq3USj/R.INSTALL592f512d9946/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 ‘/home/golbylab/R/units’
    ERROR: dependency ‘mvtnorm’ is not available for package ‘bridgesampling’
  • removing ‘/home/golbylab/R/bridgesampling’
    ERROR: dependency ‘units’ is not available for package ‘sf’
  • removing ‘/home/golbylab/R/sf’
    ERROR: dependency ‘bridgesampling’ is not available for package ‘brms’
  • removing ‘/home/golbylab/R/brms’
    ERROR: dependency ‘sf’ is not available for package ‘spdep’
  • removing ‘/home/golbylab/R/spdep’

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

++ Note: @ 11:11:07
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 ‘bridgesampling’ had non-zero exit status
3: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘sf’ had non-zero exit status
4: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘brms’ had non-zero exit status
5: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘spdep’ had non-zero exit status[/i]

Any suggestions will be highly appreicated.

Yours best,
Shun

Hi, Shun-

It is hard to say without knowing more about what operating system you are using.

What is your output of:


afni_system_check.py -check_all

?

I believe that version of R is not modern enough, but please copy+paste the output of the above command.

–pt

Hi, Dr.PT,

I am surprised for your quick response!
Thank you very very much.

Here is the information after tpying what you said,

-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 4.15.0-45-generic
version: #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019
distribution: Ubuntu 18.04 bionic
number of CPUs: 4
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/golbylab/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/golbylab/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/local/fsl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/golbylab/abin

PYTHONPATH =
R_LIBS = /home/golbylab/R

LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

------------------------------ data checks -------------------------------
data dir : found AFNI_data6 under $HOME
top history: …9 [ptaylor]: added FT_analysis/results.QC_FT.05 tree
data dir : found AFNI_demos under $HOME
top history: 17 Mar 2019 [discoraj]: added FATCAT_matplot_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/golbylab/abin

------------------------------ OS specific -------------------------------
which apt-get : /usr/bin/apt-get
apt-get version : apt 1.6.6 (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’
  • missing R packages (see rPkgsInstall)

Best,
Shun

Hi, Shun-

Thanks for sending that. I think that, indeed, you just need to update your R version. To do that in this case, you should be able to do the following

---- EDIT: well, actually wait, this appears to not have sorted things; watch this space for a better answer hopefully shortly… ---------

-pt

Shun, the installation failure of ‘brms’ is most likely due to an old version of R. Update your R and then run

rPkgsInstall -pkgs ‘brms’

Gang Wrote:

Shun, the installation failure of 'brms' is most
likely due to an old version of R. Update your R
and then run

rPkgsInstall -pkgs 'brms'

Thank you very much, Dr.Gang,

However, it still did not work. Could you please help check this error information,

Installing package into ‘/home/golbylab/R’
(as ‘lib’ is unspecified)
also installing the dependencies ‘units’, ‘mvtnorm’, ‘sf’, ‘bridgesampling’, ‘spdep’

trying URL 'http://cran.us.r-project.org/src/contrib/units_0.6-2.tar.gz'
Content type 'application/x-gzip' length 917316 bytes (895 KB)

downloaded 895 KB

trying URL 'http://cran.us.r-project.org/src/contrib/mvtnorm_1.0-10.tar.gz'
Content type 'application/x-gzip' length 159856 bytes (156 KB)

downloaded 156 KB

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 ‘units’ ...
    ** package ‘units’ successfully unpacked and MD5 sums checked
    configure: units: 0.6-2
    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 g++ accepts -g... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... 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... yes
    checking for gcc... gcc -std=gnu99
    checking whether we are using the GNU C compiler... yes
    checking whether gcc -std=gnu99 accepts -g... yes
    checking for gcc -std=gnu99 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 `/tmp/RtmpuQMPXE/R.INSTALL137ce6d879e/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 ‘/home/golbylab/R/units’
  • installing source package ‘mvtnorm’ ...
    ** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3U0YWo/r-base-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3U0YWo/r-base-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c miwa.c -o miwa.o
    gfortran -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3U0YWo/r-base-3.5.3=. -fstack-protector-strong -c mvt.f -o mvt.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3U0YWo/r-base-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c mvtnorm-init.c -o mvtnorm-init.o
    gfortran -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3U0YWo/r-base-3.5.3=. -fstack-protector-strong -c tvpack.f -o tvpack.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mvtnorm.so C_FORTRAN_interface.o miwa.o mvt.o mvtnorm-init.o tvpack.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
    installing to /home/golbylab/R/mvtnorm/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 (mvtnorm)
    ERROR: dependency ‘units’ is not available for package ‘sf’
  • removing ‘/home/golbylab/R/sf’
  • installing source package ‘bridgesampling’ ...
    ** package ‘bridgesampling’ successfully unpacked and MD5 sums checked
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error : package ‘Matrix’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
    ERROR: lazy loading failed for package ‘bridgesampling’
  • removing ‘/home/golbylab/R/bridgesampling’
    ERROR: dependency ‘sf’ is not available for package ‘spdep’
  • removing ‘/home/golbylab/R/spdep’
    ERROR: dependency ‘bridgesampling’ is not available for package ‘brms’
  • removing ‘/home/golbylab/R/brms’

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

++ Note: @ 17:33:05
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 ‘sf’ had non-zero exit status
3: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘bridgesampling’ had non-zero exit status
4: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘spdep’ had non-zero exit status
5: In install.packages(pkgs_miss, dep = TRUE, repos = site) :
installation of package ‘brms’ had non-zero exit status

Hi, Shun-

I believe that you should first remove R, because otherwise there are version conflicts. Then,

  1. open the “list” file of sources for your package manager (sudo/admin password required):

sudo gedit /etc/apt/sources.list

  1. Copy+paste this line to the bottom of that file (this gives your package manager a new place to look for files to install- specifically, R v3.5 on Ubuntu 18.04; for other people people doing this on different versions of ubuntu, instead of “bionic” one might have “xenial” (for Ubuntu 16.04) for example, whatever the fun Ubuntu name for your exact LTS version is):

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

You can save+close that file now.

  1. Refresh the list of packages that your package manager reads-- copy+paste this:

sudo apt-get update

  1. Now instruct your package manager to update its R base installation (this should get 3.5 now)-- copy+paste:

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

  1. Use the AFNI command to get necessary packages, which should now include brms-- copy+paste this:

rPkgsInstall -pkgs ALL

Note, this step miiiiight take a little while, to fully build the R package.

Run the afni_system_check again, and let us know if that sorts out your R issue.

–pt

Good morning, Pt

Sorry for the late response.
Error information come out When I uninstall the R.

  1. Here is the source list (the last several commands )
    [i]## Uncomment the following two lines to add software from Canonical’s

‘partner’ repository.

This software is not part of Ubuntu, but is offered by Canonical and the

respective vendors as a service to Ubuntu users.

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

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

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

  1. Here is the error information.
    E: Malformed entry 43 in list file /etc/apt/sources.list (Suite)
    E: The list of sources could not be read.

Do you know what’s going on with this?
It seems that the last command is something wrong

Thank you very much!
Shun

Hi,

I think there should be a space between “ubuntu” and bionic-cran35 in the uncommented deb line; unfortunately, this interface turns links into abbreviations, but it should look like the following with the underscores “_” removed:


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

Try copy+pasting that and replacing the current link (or adding the space there).

-pt

HI PT,

Thank you very much for your amazingly speedy response!
However, it still does not work. seems weird…

The same error information coming out.
E: Malformed entry 43 in list file /etc/apt/sources.list (Component)
E: The list of sources could not be read.

Following is the source list,

deb cdrom:[Ubuntu 14.04 LTS Trusty Tahr - Release amd64 (20140417)]/ trusty main restricted

See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

newer versions of the distribution.

deb http://archive.ubuntu.com/ubuntu bionic main restricted

Major bug fix updates produced after the final release of the

distribution.

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

N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

team. Also, please note that software in universe WILL NOT receive any

review or updates from the Ubuntu security team.

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

N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

team, and may not be under a free licence. Please satisfy yourself as to

your rights to use the software. Also, please note that software in

multiverse WILL NOT receive any review or updates from the Ubuntu

security team.

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

N.B. software from this repository may not have been tested as

extensively as that contained in the main release, although it includes

newer versions of some applications which may provide useful features.

Also, please note that software in backports WILL NOT receive any review

or updates from the Ubuntu security team.

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

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

Uncomment the following two lines to add software from Canonical’s

‘partner’ repository.

This software is not part of Ubuntu, but is offered by Canonical and the

respective vendors as a service to Ubuntu users.

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

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


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

Thanks for your time, great work, the awesome scientist you are!
Best,
Shun

Hi-

I am sorry, but I’m not sure. I’ve tried it on my system, and things worked.

I removed R with:


sudo apt-get remove r-base-core

Then, this is what the end of my /etc/apt/sources.list file looks like, if that is useful (though, note that this forum format will change the full links to the abbreviations, that you will have to see by clicking on them):


## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# 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 http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ bionic/

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

After that, I ran:


sudo apt-get update

so the manager could see the changes.

Then:


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

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

Then,


rPkgsInstall -pkgs ALL

… and that updated the new packages.

–pt

Thank you very much, PT,

You are very helpful.
I rarely saw that a scientist replied questions more speedy than you on any forums!
It must be something wrong with my PC, but I can not figure out what’s going on so far.
However, when I installed the R --version 3.4.4, it worked…

But, another piece of information come out showing as follows,


=========================  summary, please fix:  =========================
*  login shell 'bash', trusting user to translate code examples from 'tcsh'

Thank you, pt
Best,
Shun

Hi, Shun-

Hmm, OK, well if you have got the R packages installed, then that’s great.

If you are also asking about that message/notice at the bottom of the afni_system_check.py output, then:
It’s not something that requires you to do anything. It refers to the fact that many times when we reply to questions on the MB or put examples online, we use “tcsh” shell syntax defining variables, loops, etc. There is no very deep reason for using tcsh over bash, I don’t believe, other than tcsh appears to be a bit easier to read directly and not have some quirks like being strict about whitespace usage.

Most times, people tend to put those code snippets into scripts, anyways, so it’s really not a big deal. It’s just a notice of that fact. Using bash in your terminal is fine.

–pt

Thank you very much, PT
Have a good weekend.:)-D

Ha, cheers, indeed!

–pt