【问题标题】:Installation of non-CRAN package requires CRAN mirror安装非 CRAN 包需要 CRAN 镜像
【发布时间】:2021-09-26 11:08:20
【问题描述】:

我正在尝试在基于 Linux 的计算集群上安装 the R-INLA projectINLA 软件包。该软件包不在 CRAN 上。根据他们的教程,使用就足够了

install.packages("INLA",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)

用于安装,在我的本地机器上运行良好。但是,在计算集群上,运行此命令似乎需要一个 CRAN 镜像,我收到以下错误:

Error in contrib.url(repos, type) : 
  trying to use CRAN without setting a mirror
Calls: install.packages -> startsWith -> contrib.url
Execution halted

作为替代方案,我尝试使用 devtools 直接从相应的 GitHub 存储库安装包。出于某种原因,这给了我明显不正确的版本号INLA_99.99.9999。这禁止我通过INLA:::inla.binary.install() 手动添加必要的二进制文件,因为找不到版本号。任何帮助表示赞赏!

【问题讨论】:

    标签: r r-package r-inla


    【解决方案1】:

    您依赖于(R 全局)options() 在集群上具有有效的 repos 条目。

    如果没有基本 R Core 的感觉,无论对错,你都不能作为基本 R 发布(源代码来源),他们无法播放收藏夹并设置一个。我们中的一些人认为这是错误的(因为它降低了用户体验——就像你在这里一样)所以在 Debian(以及因此 Ubuntu)包中,我将它设置为每个人都接近的“云”镜像,就像它在 @987654321 上一样@:

    edd@rob:~$ tail -6 /usr/lib/R/etc/Rprofile.site 
    ## We set the cloud mirror, which is 'network-close' to everybody, as default
    local({
        r <- getOption("repos")
        r["CRAN"] <- "https://cloud.r-project.org"
        options(repos = r)
    })
    edd@rob:~$ 
    

    我建议你也这样做,也许在集群上的~/.Rprofile

    【讨论】:

    • 这就像一个魅力,谢谢!
    猜你喜欢
    • 2016-01-24
    • 2014-09-20
    • 2017-09-04
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 2011-05-24
    • 1970-01-01
    相关资源
    最近更新 更多