从源代码安装包时出现解析错误(以包rms为例)

k2fxgqgv  于 2023-05-04  发布在  其他
关注(0)|答案(2)|浏览(391)

我在LMDE上(也就是说,在基于Debian的操作系统上,如Ubuntu):

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

安装库时不断出现错误。有时我会遇到本地解决方案,但通常它们对我不起作用(比如安装依赖包,安装更高版本,从github安装等)。)。对于rms包,我尝试了以下方法,结果如下。

尝试次数

尝试1:

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

pacman::p_install(rms)

日志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) :

尝试2:

install.packages("rms")

日志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’

尝试3:

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

日志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’

尝试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)

日志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

Hmisc错误,因此尝试安装此:

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

日志:

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’

安装软件包ggplot2colorspace也没有帮助。
仍然有一些与字体相关的错误,也许还有更多,但重新安装后,我再也看不到它们了。
我在以下链接中没有找到任何其他内容:123
那么我该如何安装这个软件包呢?一般来说,我该如何轻松地安装软件包呢?

zd287kbt

zd287kbt1#

尝试像this这样的“终端”安装:

sudo apt install r-cran-rms

在终端:

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第一次有更多的文字)
检查:

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

该软件包的当前CRAN版本是6。6.0
备注---仅在终端相应删除,如this

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

如果这种方法不起作用,请尝试在R中安装您的软件包并阅读安装日志。最重要的是,会有一个安装软件包的建议,所以这样做。
如果与版本有关,请尝试更新软件包(注意,更新R需要重新安装所需的库)。如果不起作用,请尝试BACKPORTS

yqkkidmi

yqkkidmi2#

tl;dr这些软件包的当前版本不能与4之前的R版本一起使用。1.这可以说是这些包中的一个bug:它们的描述文件应该要求R〉= 4。1.0(在这种情况下,你会得到一个 * 稍微 * 更多信息的消息,告诉你这个包对你的R版本不可用);参见here

要解决此问题,您可以:

  • 更新您的R版本
  • 查看Hmiscrms的存档页面,并使用remotes::install_version()安装早期版本。特别是,自R 4。1是在May 2018中发布的,在此之前的任何Hmisc/rms版本都应该可以工作。更一般地说,我怀疑有比2018年5月更新的版本不使用本机管道,但很难追踪更改的时间。
  • 如您所建议的,通过apt从Debian风格的存储库安装,该存储库提供了软件包的旧版本,如this answer

关键是形式的错误

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 in parse(outFile) : 
  /tmp/Rtmp2kS6VC/R.INSTALL3a165bca1f38/Hmisc/R/movStats.r:398:43: unexpected '>'

这是因为您的R版本无法解析“本机管道”|>,这是在R4之前才添加的。1.

相关问题