【问题标题】:R devtools::install_github() error in download: unauthorizedR devtools::install_github() 下载错误:未经授权
【发布时间】:2016-02-17 22:40:22
【问题描述】:

我正在尝试将 R 绑定到 Twitter,但我尝试的一切都失败了。我一直在查看几个链接,包括以下链接:OneTwoThree

虽然这些导致了更多问题,但我现在正在查看链接 herehere 以尝试一些解决方法。我会将我的问题作为评论发布到这些链接中的任何一个,但我还没有足够的代表。

当我运行以下代码时,出现以下错误

代码:

library(base64enc)
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
devtools::install_github("jrowen/twitteR", user="MY_USERNAME", password="MY_PASSWORD", ref = "oauth_httr_1_0")

错误:

WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.3 from http://cran.r-project.org/bin/windows/Rtools/ and then run find_rtools().
Downloading GitHub repo jrowen/twitteR@oauth_httr_1_0
Error in download(dest, src, auth) : client error: (401) Unauthorized

我只是在如何下载这个开发 twitteR 包方面完全遗漏了一些东西吗?有没有人知道如何克服 401 错误?

谢谢,

【问题讨论】:

  • 你安装 Rtools 了吗?
  • 不认为它是必要的,因为我没有构建包。我会尝试的。
  • 即使在安装 Rtools 并重新启动 R 之后,我也会遇到同样的错误。如下所述,当我离开 set_config( config( ssl_verifypeer = 0L ) ) 时,我收到错误 Downloading GitHub repo jrowen/twitteR@oauth_httr_1_0 Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates
  • @JRW buildingdeveloping 包之间存在差异。构建意味着编译代码。您需要它来安装任何已编译代码的包。安装 Rtools 时要注意的一件事是fix your path

标签: r github oauth twitter-oauth github-api


【解决方案1】:

您是否在上面引用的会话中安装并获取了R tools?您没有收到证书错误(您以前是吗?),这表明您没有运行证书服务器,就像您的某些链接帖子中的问题一样。

我建议按照以下步骤来查找您的问题。

你可能需要 httpuv 包,可以下载源代码

install.packages('httpuv')
library('httpuv')

有时 twitteR 包需要旧版本的 httr 才能正常工作,这取决于 jrowen(和 hadley)的更新。

您可以尝试安装旧版本的 httr

 devtools::install_version("httr", version="0.6.0", repos="http://cran.us.r-project.org")

并重新启动 R,然后再次尝试安装。请注意,如果您使用的是 64 位计算机,则可能必须先安装最新版本的 httr,然后再安装旧版本。

【讨论】:

  • 我将安装和获取 Rtools 并尝试一下。正如我向@Roman 提到的那样,我认为不需要它,因为我实际上并没有构建包。我已经收到了用户在我发布的链接中遇到的所有证书和身份验证错误。此外,我尝试使用您提供的代码安装较旧的 httr,但我也收到了 Error in download(bundle, x$url, x$config) : client error: (401) Unauthorized 错误。
  • 现在省略set_config( config( ssl_verifypeer = 0L ) ) 部分并在安装Rtools 后尝试安装httr,我收到Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/httr/httr_0.6.0.tar.gz Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates 错误。离开那块也让我回到 twitteR 安装中的 Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates 错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-05
  • 2015-04-19
  • 2013-02-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多