`库中的错误检查点:运行 R 脚本时没有名为“检查点”的包

问题描述

我的系统是 debian 10,测试脚本如下:

me@pc:~$ cat << EOF >> packages.r
#!/usr/bin/Rscript
install.packages('checkpoint',quiet=TRUE,lib='/home/me/R/x86_64-pc-linux-gnu-library/3.5')
library(checkpoint)
checkpoint::setSnapshot("2020-08-26")
EOF

me@pc:~$ ./packages.r
./packages.r
also installing the dependencies ‘curl’,‘pkgcache’,‘pkgdepends’

Warning messages:
1: In install.packages("checkpoint",quiet = TRUE,lib = "/home/me/R/x86_64-pc-linux-gnu-library/3.5") :
  installation of package ‘curl’ had non-zero exit status
2: In install.packages("checkpoint",lib = "/home/me/R/x86_64-pc-linux-gnu-library/3.5") :
  installation of package ‘pkgcache’ had non-zero exit status
3: In install.packages("checkpoint",lib = "/home/me/R/x86_64-pc-linux-gnu-library/3.5") :
  installation of package ‘pkgdepends’ had non-zero exit status
4: In install.packages("checkpoint",lib = "/home/me/R/x86_64-pc-linux-gnu-library/3.5") :
  installation of package ‘checkpoint’ had non-zero exit status
Error in library(checkpoint) : there is no package called ‘checkpoint’
Execution halted

由于包checkpoint无法正确安装,我尝试直接在R shell中安装:

me@pc:~$ R
R

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos,'help()' for on-line help,or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages('checkpoint',lib='/home/me/R/x86_64-pc-linux-gnu-library/3.5')
also installing the dependencies ‘curl’,lib = "/home/me/R/x86_64-pc-linux-gnu-library/3.5") :
  installation of package ‘checkpoint’ had non-zero exit status

安装包 checkpoint 时有什么问题?

解决方法

apt install libcurl4-openssl-dev,然后这个问题就解决了。