【问题标题】:R: Cannot use 0-cloud to install.packagesR: 不能使用 0-cloud 来安装.packages
【发布时间】:2015-07-14 17:56:16
【问题描述】:

当我尝试从 0-cloud 安装软件包时,它不起作用

> install.packages("lfactors")
--- Please select a CRAN mirror for use in this session ---

然后我从存储库列表中选择 0-cloud。 R返回

Warning: unable to access index for repository https://cran.rstudio.com/src/contrib
Warning: unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.2
Warning message:
package ‘lfactors’ is not available (for R version 3.2.1) 

但是,当我运行此代码并选择另一个存储库时,它确实可以工作。

我尝试关闭我的代理服务器,并在代理服务器开启的情况下访问该站点,我可以在浏览器中毫无问题地访问它。

有什么想法吗?

编辑: 根据评论,我运行了这个

capabilities()["libcurl"]
libcurl 
   TRUE

所以我认为不是这样。

【问题讨论】:

    标签: r rstudio


    【解决方案1】:

    您的 R 二进制文件可能是在没有 curl 支持的情况下构建的,并且您无法访问 https 服务器。看看这会返回什么:

    R> capabilities()["libcurl"]
    libcurl 
       TRUE 
    R> 
    

    如果这是您的FALSE,请做两件事:

    1. options("repos") 更改为使用 http 而不是 https。

    2. 重建 R 以获得 libcurl 支持。

    我在Rprofile.site:

    ## Example of Rprofile.site
    local({
        r <- getOption("repos")
        r["CRAN"] <- "http://cran.rstudio.com"    ## not https for you
        options(repos = r)
    })
    

    编辑:另一种可能性,尤其是在 Windows 上,是 internet2 dll 必须被激活,所以运行一次 setInternet2(TRUE) 应该会有所帮助。

    【讨论】:

    • 我编辑了这个问题,但它看起来不像它是什么。我有 R 团队构建的 Windows 二进制文件。
    • 我明白了,你可以在install.packages() 调用之前尝试setInternet2(TRUE) 吗?
    • IIRC 它启用了 libcurl 需要的东西。这最近也成为下一个 R 版本的默认设置(在 Windows 上)。参见例如here for the NEWS entry
    • 如果有建议,我会将其标记为答案。我不确定论坛礼仪说什么,我应该编辑它吗?
    • 我能做到,感谢您先提出来 :)
    猜你喜欢
    • 2017-01-15
    • 1970-01-01
    • 2019-09-10
    • 2019-04-15
    • 2021-01-02
    • 2017-07-26
    • 1970-01-01
    • 2012-01-16
    • 2019-08-31
    相关资源
    最近更新 更多