-1

I'm on LMDE (that is, on a Debian-based OS like Ubuntu):

R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: LMDE 5 (elsie)

and keep getting an error installing libraries. Sometimes I come across local solutions, but usually they don't work for me (like installing dependent packages, installing later versions, installing from github, etc.). For package rms I tried the following with the following results.


Attempts

Attempt 1:

if (!require("pacman"))
  install.packages("pacman")

pacman::p_install(rms)

Logs 1:

Installing package into ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependency ‘Hmisc’

"download"

* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Hmisc.c -o Hmisc.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcn.f -o cidxcn.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcp.f -o cidxcp.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c hoeffd.f -o hoeffd.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c jacklins.f -o jacklins.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c largrec.f -o largrec.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c mChoice.c -o mChoice.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c maxempr.f -o maxempr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c nstr.c -o nstr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ranksort.c -o ranksort.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c rcorr.f -o rcorr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c string_box.c -o string_box.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c wclosest.f -o wclosest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o init.o jacklins.o largrec.o mChoice.o maxempr.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-Hmisc/00new/Hmisc/libs
** R
Error in parse(outFile) : 
  /tmp/Rtmp2kS6VC/R.INSTALL3a165bca1f38/Hmisc/R/movStats.r:398:43: unexpected '>'
397:             else
398:               info <- knitr::kable(info) |>
                                               ^
ERROR: unable to collate and parse R files for package ‘Hmisc’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/Hmisc’
* installing *source* package ‘rms’ ...
** package ‘rms’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c lrmfit.f -o lrmfit.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c mlmats.f -o mlmats.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c ormuv.f -o ormuv.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c robcovf.f -o robcovf.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o rms.so init.o lrmfit.o mlmats.o ormuv.o robcovf.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-rms/00new/rms/libs
** R
Error in parse(outFile) : 
  /tmp/RtmpsUMuRd/R.INSTALL3a5392a2cc/rms/R/latex.cph.s:56:49: unexpected '>'
55:       knitr::kable(s, format='html',
56:                    align='r', row.names=FALSE) |>
                                                    ^
ERROR: unable to collate and parse R files for package ‘rms’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/rms’

The downloaded source packages are in
    ‘/tmp/RtmpUQQ6Hn/downloaded_packages’
Warning messages:
1: In utils::install.packages(package, ...) :
  installation of package ‘Hmisc’ had non-zero exit status
2: In utils::install.packages(package, ...) :
  installation of package ‘rms’ had non-zero exit status
3: In pacman::p_install(rms) :

Attempt 2:

install.packages("rms")

Logs 2:

Installing package into ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘rvest’, ‘svglite’, ‘Hmisc’, ‘kableExtra’

trying URL 'https://cloud.r-project.org/src/contrib/rvest_1.0.3.tar.gz'

"download"

* installing *source* package ‘rvest’ ...
** package ‘rvest’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** 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 from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rvest)
* installing *source* package ‘svglite’ ...
** package ‘svglite’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/r/R/x86_64-pc-linux-gnu-library/4.0/cpp11/include' -I'/usr/lib/R/site-library/systemfonts/include'    -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c cpp11.cpp -o cpp11.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/home/r/R/x86_64-pc-linux-gnu-library/4.0/cpp11/include' -I'/usr/lib/R/site-library/systemfonts/include'    -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c devSVG.cpp -o devSVG.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o svglite.so cpp11.o devSVG.o -lpng -lz -L/usr/lib/R/lib -lR
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-svglite/00new/svglite/libs
** R
** 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 from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (svglite)
* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Hmisc.c -o Hmisc.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcn.f -o cidxcn.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcp.f -o cidxcp.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c hoeffd.f -o hoeffd.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c jacklins.f -o jacklins.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c largrec.f -o largrec.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c mChoice.c -o mChoice.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c maxempr.f -o maxempr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c nstr.c -o nstr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ranksort.c -o ranksort.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c rcorr.f -o rcorr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c string_box.c -o string_box.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c wclosest.f -o wclosest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o init.o jacklins.o largrec.o mChoice.o maxempr.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-Hmisc/00new/Hmisc/libs
** R
Error in parse(outFile) : 
  /tmp/RtmpZwFrAl/R.INSTALL2fd8571b94db/Hmisc/R/movStats.r:398:43: unexpected '>'
397:             else
398:               info <- knitr::kable(info) |>
                                               ^
ERROR: unable to collate and parse R files for package ‘Hmisc’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/Hmisc’
Warning in install.packages :
  installation of package ‘Hmisc’ had non-zero exit status
* installing *source* package ‘kableExtra’ ...
** package ‘kableExtra’ successfully unpacked and MD5 sums checked
** using staged installation
** 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 from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (kableExtra)
* installing *source* package ‘rms’ ...
** package ‘rms’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c lrmfit.f -o lrmfit.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c mlmats.f -o mlmats.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c ormuv.f -o ormuv.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c robcovf.f -o robcovf.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o rms.so init.o lrmfit.o mlmats.o ormuv.o robcovf.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-rms/00new/rms/libs
** R
Error in parse(outFile) : 
  /tmp/Rtmpg5dNg6/R.INSTALL304c1b431630/rms/R/latex.cph.s:56:49: unexpected '>'
55:       knitr::kable(s, format='html',
56:                    align='r', row.names=FALSE) |>
                                                    ^
ERROR: unable to collate and parse R files for package ‘rms’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/rms’
Warning in install.packages :
  installation of package ‘rms’ had non-zero exit status

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

Attempt 3:

install.packages("rms", dependencies = T, Ncpus = 12)

Logs 3:

Installing package into ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘Hmisc’, ‘rmsb’

trying URL 'https://cloud.r-project.org/src/contrib/Hmisc_5.0-1.tar.gz'

"download"

trying URL 'https://cloud.r-project.org/src/contrib/rms_6.6-0.tar.gz'

"download"

begin installing package ‘Hmisc’
make: *** [Makefile:4: Hmisc.ts] Error 1
make: Target 'all' not remade because of errors.
* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
make[1]: Entering directory '/tmp/RtmpryJGgV/R.INSTALL3110717eb705/Hmisc/src'
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Hmisc.c -o Hmisc.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcn.f -o cidxcn.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcp.f -o cidxcp.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c hoeffd.f -o hoeffd.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c jacklins.f -o jacklins.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c largrec.f -o largrec.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c mChoice.c -o mChoice.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c maxempr.f -o maxempr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c nstr.c -o nstr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ranksort.c -o ranksort.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c rcorr.f -o rcorr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c string_box.c -o string_box.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c wclosest.f -o wclosest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o init.o jacklins.o largrec.o mChoice.o maxempr.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
make[1]: Leaving directory '/tmp/RtmpryJGgV/R.INSTALL3110717eb705/Hmisc/src'
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-Hmisc/00new/Hmisc/libs
** R
Error in parse(outFile) : 
  /tmp/RtmpryJGgV/R.INSTALL3110717eb705/Hmisc/R/movStats.r:398:43: unexpected '>'
397:             else
398:               info <- knitr::kable(info) |>
                                               ^
ERROR: unable to collate and parse R files for package ‘Hmisc’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/Hmisc’
cat: rms.out: No such file or directory
cat: rmsb.out: No such file or directory
Warning in install.packages :
  installation of one or more packages failed,
  probably ‘Hmisc’, ‘rms’, ‘rmsb’

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

Attempt 4:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/rms/rms_6.5-0.tar.gz"
install.packages(packageurl, repos = NULL, type = "source", Ncpus = 12)

Logs 4:

Installing package into ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/src/contrib/Archive/rms/rms_6.5-0.tar.gz'

"download"

* installing *source* package ‘rms’ ...
** package ‘rms’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c lrmfit.f -o lrmfit.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c mlmats.f -o mlmats.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c ormuv.f -o ormuv.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c robcovf.f -o robcovf.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o rms.so init.o lrmfit.o mlmats.o ormuv.o robcovf.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-rms/00new/rms/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error: package ‘Hmisc’ 4.5.0 was found, but >= 4.8.0 is required by ‘rms’
Execution halted
ERROR: lazy loading failed for package ‘rms’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/rms’
Warning in install.packages :
  installation of package ‘/tmp/RtmpUQQ6Hn/downloaded_packages/rms_6.5-0.tar.gz’ had non-zero exit status

Error with Hmisc hence try install this:

install.packages("Hmisc", dependencies = T, Ncpus = 12)

Logs:

Installing package into ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘qreport’, ‘rms’

trying URL 'https://cloud.r-project.org/src/contrib/qreport_0.1.0.tar.gz'

"download"

trying URL 'https://cloud.r-project.org/src/contrib/rms_6.6-0.tar.gz'

"download"

trying URL 'https://cloud.r-project.org/src/contrib/Hmisc_5.0-1.tar.gz'

"download"

begin installing package ‘Hmisc’
make: *** [Makefile:4: Hmisc.ts] Error 1
make: Target 'all' not remade because of errors.
* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
make[1]: Entering directory '/tmp/RtmpH728Mq/R.INSTALL35046481c0f2/Hmisc/src'
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Hmisc.c -o Hmisc.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcn.f -o cidxcn.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c cidxcp.f -o cidxcp.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c hoeffd.f -o hoeffd.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c jacklins.f -o jacklins.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c largrec.f -o largrec.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c mChoice.c -o mChoice.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c maxempr.f -o maxempr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c nstr.c -o nstr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ranksort.c -o ranksort.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c rcorr.f -o rcorr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c string_box.c -o string_box.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-XqSJAD/r-base-4.0.4=. -fstack-protector-strong  -c wclosest.f -o wclosest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o init.o jacklins.o largrec.o mChoice.o maxempr.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
make[1]: Leaving directory '/tmp/RtmpH728Mq/R.INSTALL35046481c0f2/Hmisc/src'
installing to /home/r/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-Hmisc/00new/Hmisc/libs
** R
Error in parse(outFile) : 
  /tmp/RtmpH728Mq/R.INSTALL35046481c0f2/Hmisc/R/movStats.r:398:43: unexpected '>'
397:             else
398:               info <- knitr::kable(info) |>
                                               ^
ERROR: unable to collate and parse R files for package ‘Hmisc’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/Hmisc’
cat: rms.out: No such file or directory
cat: qreport.out: No such file or directory
Warning in install.packages :
  installation of one or more packages failed,
  probably ‘Hmisc’, ‘rms’, ‘qreport’

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

Installing packages ggplot2 and colorspace didn't help either.

There were still errors related to fonts and maybe some more, but after reinstalling I didn't see them anymore.

I didn't find anything else on the following links: 1 2 3

So how do I install this package and in general, how do I install packages painlessly?

roma
  • 25
  • 8
  • 1
    Welcome to StackOverflow. I am not entirely sure _what exactly your question is_ but I can point out a) that the [r-sig-debian list and its archive](https://stat.ethz.ch/mailman/listinfo/r-sig-debian) are a great resource to discuss any aspects of R on Debian-based distros and b) that [r2u](https://eddelbuettel.github.io/r2u/) offers you all nearly 20k CRAN packages as binaries for Ubuntu 20.04 and 22,04 -- with an interface from `install.package()` to you could say `install.packages(c("readxl", "janitor", "rms"))` and get these (or others!) _with all their dependencies_ as binaries. Try it! – Dirk Eddelbuettel Apr 30 '23 at 14:20
  • StackOverflow is not a wiki, and this is not a question. – Dirk Eddelbuettel Apr 30 '23 at 14:23
  • StackOverflow has a well-defined set of rules and guidelines about what constitutes a valid question in the context of the site. This is simple not one so expect this to get deleted. – Dirk Eddelbuettel Apr 30 '23 at 14:29
  • 4
    Your "question" of `How to install any library in R?` is indeed a question, but the content itself is not framed as a question, more like (1) an answer, (2) a wiki, or (3) an invitation to discuss other options. None of those fit in the model of Stack questions/answers. If you are looking to resolve specific installation problems (from your `getting an error installing libraries`), then perhaps you should approach _that specific problem_ (and include the actual errors you see). – r2evans Apr 30 '23 at 14:49
  • 1
    @roma, the usual way to do that is as follows. Specify your question. Point out the similar questions you could find, and explain why each of their answers doesn't work for you. You should expect someone else to find yet another similar question, and then maybe your question will be closed as a duplicate, or maybe you can point out why it also doesn't work for you. Finally, if you have a new solution that does work, you could add it as an answer to your own question. – user2554330 Apr 30 '23 at 20:07
  • Questions that are modified do get bumped to the top if people are listing posts in "activity" order, but in general stuff gets buried very quickly on Stack Overflow anyway - there are currently more than 30 posts on the [r] tag that have been active in the last hour ... – Ben Bolker May 02 '23 at 13:13

2 Answers2

2

tl;dr the current version of these packages won't work with versions of R earlier than 4.1. This is arguably a bug in these packages: their DESCRIPTION files ought to mandate R >= 4.1.0 (in which case you would get a slightly more informative message telling you that the package was unavailable for your version of R); see here.

To resolve the issue you could:

  • update your version of R
  • look on the archive pages for Hmisc and rms and use remotes::install_version() to install earlier versions. In particular, since R 4.1 was released in May 2018, any version of Hmisc/rms dated before that should work. More generally, I suspect that there are versions more recent than May 2018 that don't use the native pipe, but it's hard to track down when the changes were made.
  • as you suggest, install via apt from a Debian-style repository that provides an older version of the package, as in this answer

The key is the errors of the form

Error in parse(outFile) : 
  /tmp/RtmpsUMuRd/R.INSTALL3a5392a2cc/rms/R/latex.cph.s:56:49: unexpected '>'
55:       knitr::kable(s, format='html',
56:                    align='r', row.names=FALSE) |>

or

Error in parse(outFile) : 
  /tmp/Rtmp2kS6VC/R.INSTALL3a165bca1f38/Hmisc/R/movStats.r:398:43: unexpected '>'

which occur because your version of R is failing to parse the "native pipe" |>, which wasn't added until R 4.1.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • 1
    I think that if you install via `apt` and are pointing at a source that is consistent with your installed version of R, you'll be installing an older (and hence compatible) version of the package. You can try `packageVersion("rms")` (from within R) and compare with what's listed on CRAN. – Ben Bolker May 02 '23 at 15:54
  • 1
    I was explaining *why* installing via `apt` worked. – Ben Bolker May 02 '23 at 16:16
  • That is, the `apt` installs the latest package for your version of R, which means that this package may not be the latest. Did I understand correctly? – roma May 02 '23 at 16:30
  • 1
    Yes. Your question basically boils down to a duplicate that is answered here: https://stackoverflow.com/a/31293955/190277 – Ben Bolker May 02 '23 at 16:32
  • I don't think so. This isn't technically an exact duplicate of that question, as that is *not* the error you saw (because of the failure of the package maintainer to update the requirements). Using hindsight, you could edit the *title* to something like "parse error when installing packages from source"; that might make the question more specific/useful. – Ben Bolker May 02 '23 at 17:03
  • This version is good, because it runs in R, but you need to find out the latest versions of the packages for the current version of R (I was never able to find it) and it is possible to install an additional package. But I need a terminal and deletion through the terminal (at least I did not succeed in deleting the package installed by the terminal in the R environment). – roma May 02 '23 at 17:40
0

Try a "terminal" install like this:

sudo apt install r-cran-rms

In the terminal:

r@ma:~$ sudo apt install r-cran-rms
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  r-cran-polspline
The following NEW packages will be installed:
  r-cran-polspline r-cran-rms
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,670 kB of archives.
After this operation, 3,242 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://deb.debian.org/debian bullseye/main amd64 r-cran-polspline amd64 1.1.19-1 [567 kB]
Get:2 https://deb.debian.org/debian bullseye/main amd64 r-cran-rms amd64 6.1-1-1 [2,103 kB]
Fetched 2,670 kB in 1s (3,210 kB/s)
Selecting previously unselected package r-cran-polspline.
(Reading database ... 366788 files and directories currently installed.)
Preparing to unpack .../r-cran-polspline_1.1.19-1_amd64.deb ...
Unpacking r-cran-polspline (1.1.19-1) ...
Selecting previously unselected package r-cran-rms.
Preparing to unpack .../r-cran-rms_6.1-1-1_amd64.deb ...
Unpacking r-cran-rms (6.1-1-1) ...
Setting up r-cran-polspline (1.1.19-1) ...
Setting up r-cran-rms (6.1-1-1) ...
r@ma:~$ 

(the first time there was more text)

Check:

packageVersion("rms")
[1] ‘6.1.1’

The current CRAN version of the package is 6.6.0

Remark --- delete only in terminal accordingly like this:

sudo apt --purge remove r-cran-rms
sudo apt autoremove

If this method doesn't work, try installing your package in R and read the installation log. Most of all, there will be an advice to install packages, so do that.

If it's something to do with the versions, try updating the packages (be careful, updating R requires reinstalling the required libraries). If that didn't work, try BACKPORTS


EDIT: After a clean reinstallation of R, there were recommendations for installing packages in the terminal, so it is worth installing immediately through the terminal as in this answer, and not “listen to the advice”, because it is simply faster.

Here is a list of “tips” and errors:

------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘xml2’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/xml2’
* installing *source* package ‘systemfonts’ ...
** package ‘systemfonts’ successfully unpacked and MD5 sums checked
** using staged installation
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lfontconfig -lfreetype
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the fontconfig freetype2 library. Try installing:
 * deb: libfontconfig1-dev (Debian, Ubuntu, etc)
 * rpm: fontconfig-devel (Fedora, EPEL)
 * csw: fontconfig_dev (Solaris)
 * brew: freetype (OSX)
If fontconfig freetype2 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a fontconfig freetype2.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: fontconfig/fontconfig.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘systemfonts’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/systemfonts’
cat: svglite.out: No such file or directory
cat: rvest.out: No such file or directory
cat: kableExtra.out: No such file or directory
* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
make[1]: Entering directory '/tmp/RtmpYdlema/R.INSTALL51423e162a23/Hmisc/src'
...
** R
Error in parse(outFile) : 
  /tmp/RtmpYdlema/R.INSTALL51423e162a23/Hmisc/R/describe.s:1443:63: unexpected '>'
1442:   
1443:   b <- gt::gt(a)                                             |>
                                                                    ^
ERROR: unable to collate and parse R files for package ‘Hmisc’
* removing ‘/home/r/R/x86_64-pc-linux-gnu-library/4.0/Hmisc’
cat: rms.out: No such file or directory
cat: rmsb.out: No such file or directory
Warning in install.packages :
  installation of one or more packages failed,
  probably ‘xml2’, ‘systemfonts’, ‘svglite’, ‘rvest’, ‘kableExtra’, ‘Hmisc’, ‘rms’, ‘rmsb’

The downloaded source packages are in
    ‘/tmp/RtmpwQrnGW/downloaded_packages’
roma
  • 25
  • 8