无法使用 jupyter notebook 安装任何 R 包

Can't install any R package with jupyter notebook

每当我尝试使用 jupyter notebook 安装任何软件包时都会收到此错误

  There is a binary version available but the source version is later:
     binary source needs_compilation
Rcpp  1.0.6  1.0.8              TRUE

installing the source package 'Rcpp'

Warning message in install.packages("Rcpp"):
"installation of package 'Rcpp' had non-zero exit status"

对于这个特定的包,我可以用 conda install 安装它,但是像 lifecontingencies 这样的包不起作用,我用 install.packages('lifecontingencies')[=17= 收到了这条消息]

also installing the dependencies 'Rcpp', 'markovchain'


  There are binary versions available but the source versions are later:
                   binary source needs_compilation
Rcpp                1.0.6  1.0.8              TRUE
markovchain       0.8.5-4  0.8.6              TRUE
lifecontingencies   1.3.7  1.3.8              TRUE

installing the source packages 'Rcpp', 'markovchain', 'lifecontingencies'

Warning message in install.packages("lifecontingencies"):
"installation of package 'Rcpp' had non-zero exit status"Warning message in install.packages("lifecontingencies"):
"installation of package 'markovchain' had non-zero exit status"Warning message in install.packages("lifecontingencies"):
"installation of package 'lifecontingencies' had non-zero exit status"

我用 Conda 得到了这个

有没有办法修复 jupyter notebook 中的 install.packages 命令? 我的 R 版本是 3.6.1 (2019-07-05)

CRAN 包 lifedependencies 现在可以通过 Conda Forge 获得。1 我通常建议所有 Conda R 环境应该来自 Conda 的源包,否则可能会遇到编译(实际上是库链接)问题。

conda install -c conda-forge r-lifedependencies

但是请注意,目前仅适用于 R 4.0 和 4.1。如果确实需要 R 3.6 版本,请通过 filing an Issue on the feedstock.

申请

为了将来参考, 中有一些关于将 CRAN 包添加到 Conda Forge 的详细信息。


[1]: 请注意,R 包在 Conda 生态系统中通常以 r- 为前缀。