简体   繁体   English

无法从 github 安装 R-package

[英]unable to install R-package from github

I'm trying to install a flowIncubator package from github (link to the package: https://github.com/RGLab/flowIncubator ).我正在尝试从 github 安装 flowIncubator 包(该包的链接: https : //github.com/RGLab/flowIncubator )。 I'm using R version 3.3.1 (2016-06-21).我正在使用 R 版本 3.3.1 (2016-06-21)。 I've tried this code: devtools::install_github("RGLab/flowIncubator") & get this error:我试过这个代码: devtools::install_github("RGLab/flowIncubator")并得到这个错误:

  Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
      Timeout was reached
    > traceback()
    12: .Call(R_curl_fetch_disk, url, handle, path, "wb", nonblocking)
    11: curl::curl_fetch_disk(url, x$path, handle = handle)
    10: request_fetch.write_disk(req$output, req$url, handle)
    9: request_fetch(req$output, req$url, handle)
    8: request_perform(req, hu$handle$handle)
    7: httr::GET(url, path = path, httr::write_disk(path = tmp))
    6: remote_package_name.github_remote(remote)
    5: remote_package_name(remote)
    4: FUN(X[[i]], ...)
    3: vapply(remotes, install_remote, ..., FUN.VALUE = logical(1))
    2: install_remotes(remotes, quiet = quiet, ...)
    1: devtools::install_github("RGLab/flowIncubator")

I've tried to update both packages devtools & curl, I've tried to update R to an older version, I've tried to download the .zip file and install it through R studio & then load the package from the library.我尝试更新两个包 devtools 和 curl,我尝试将 R 更新到旧版本,我尝试下载 .zip 文件并通过 R studio 安装它,然后从库中加载包。 I've also tried directly putting the package file into the library.我也试过直接将包文件放入库中。 I've used functions install.packages(), but wasn't able install it.我使用了 install.packages() 函数,但无法安装它。

I've found the problem.我找到了问题所在。 It seems that my DNS server is extremely slow and that is making the timeout problem.似乎我的 DNS 服务器非常慢,这造成了超时问题。

Switching to an alternative DNS server like Google solved the issue.切换到像 Google 这样的备用 DNS 服务器解决了这个问题。

One instance where this error occurs is when you're behind a firewall.发生此错误的一种情况是当您位于防火墙后面时。 One way to bypass this is to download and install the package manually.绕过此问题的一种方法是手动下载并安装软件包。

# 1. Find the location where R saves installed packages:
libpath <- .libPaths()

# 2. On the Github webpage of the package you want to install, 
## in the top right corner click on "Clone or download", 
## then click "Download ZIP", save it, unzip it, 
## and place it in the `libpath` directory identified in the previous step.

# 3. In R, set the working directory to `libpath`
setwd(libpath[1])

#4. Install and load the package manually using the `install()` function of 
#   the `devtools` package:
install("flowIncubator")
library(flowIncubator)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM