install_github()安装github包出错

需求

  由于使用monocle2做拟时间分析的时候,结果 一直不如意,因此考虑看看有没有别的工具做拟时间分析,结果一查,还真发现2019年4月发表在NB杂志上的一个拟时间分析工具,NB影响因子30多,说明这个工具还不错,并看了一下说明,感觉比现有的工具要好用,因此想尝试一下,新工具为Github 上面的R包,安装如下:

# install.packages("devtools")
devtools::install_github("dynverse/dyno")

但是一直出现如下报错:

> devtools::install_github("dynverse/dyno")
Downloading GitHub repo dynverse/dyno@master
tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Error in getrootdir(untar(src, list = TRUE)) : 
  length(file_list) > 0 is not TRUE
In addition: Warning messages:
1: In utils::untar(tarfile, ...) :
  ‘tar -xf '/tmp/Rtmpm6BNg9/filecf7151de6e4a.tar.gz' -C '/tmp/Rtmpm6BNg9/remotescf7125f7b346'’ returned error code 2
2: In system(cmd, intern = TRUE) :
  running command 'tar -tf '/tmp/Rtmpm6BNg9/filecf7151de6e4a.tar.gz'' had status 2

自己折腾了好久,也找不到原因,也想过下载离线包,再安装,但是安装的时候又需要依赖其他4个包,这四个包总不能都下载安装吧?

解决方案

  通过查询大量资料,终于找到蛛丝马迹,Github上面 r-lib/devtools的bug讨论界面
Error with x::install_github when using packrat 有相关说明,原来早就有前辈趟过坑,这就好说了,最终解决方案如下:

#先查看一下下载工具是啥?
> getOption("download.file.method")
[1] "curl"
>options("download.file.method" = "libcurl")
#具体原因没有弄明白,反正改一种下载方式就不在报上述错误

其他可能install_github()安装出错

  在查下上述报错的过程中,看到了其他install_github()安装R包可能会出错的地方,比如quan575介绍的出错和解决方案。

> devtools::install_github('ramnathv/rCharts')
Downloading GitHub repo ramnathv/rCharts@master
from URL https://api.github.com/repos/ramnathv/rCharts/zipball/master
Installation failed: 调用命令时发生了错误

> options(unzip = 'internal')
> devtools::install_github('ramnathv/rCharts')
Downloading GitHub repo ramnathv/rCharts@master
from URL https://api.github.com/repos/ramnathv/rCharts/zipball/master
Installing rCharts
'/home/q/miniconda2/lib/R/bin/R' --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpxWnjnJ/devtools3b6d527fb677/ramnathv-rCharts-479a4f9'  \
  --library='/home/q/miniconda2/lib/R/library' --install-tests 

* installing *source* package ‘rCharts’ ...
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rCharts)

如果是链接问题可设置
options(download.file.method = "wget")或者options(download.file.method = "libcurl")

你可能感兴趣的:(install_github()安装github包出错)