R语言

从GitHub安装R包报错Error: Failed to in

2019-12-13  本文已影响0人  天涯清水

从GitHub安装R包报错Error: Failed to install 'Rpackage' from GitHub: Does not appear to be an R package (no DESCRIPTION)

一、问题:

前天在办公室电脑上安装上了“四个万能包”生信技能树良心佳作-Jimmy的四个万能R包;昨天在自己电脑上安装生信技能树良心佳作-Jimmy的四个万能R包

报错如下:Error: Failed to install 'idmap2' from GitHub:
Does not appear to be an R package (no DESCRIPTION)

搜索了一下,这个报错还是挺常见的,看了很多推文没有找到这一问题的解决办法。

二、从GitHub上安装R包的方法

首先,要了解从Github上装R包的方法:

主要有两种:

第一种:

library(devtools)
install_github("xx.Rpackage")

第二种:

BiocManager::install('githubinstall')
library(githubinstall)

githubinstall("xx.Rpackage")

从GitHub安装R包当然还有其他方法,更多细节可以参考下列推文:
🎣®[转载][R]从Github上轻松安装R包①—githubinstall包
🎣®[R]从Github上轻松安装R包②补充
🎣®[转载][R]从Github上轻松安装R包—githubinstall包 - 简书 https://www.jianshu.com/p/b33dc9d994a9

三、解决方法

尝试各种安装方法,看报错信息,发现报错信息都一样。

library(devtools)
install_github("jmzeng1314/idmap2")
Downloading GitHub repo jmzeng1314/idmap2@master
jmzeng1314-idmap2-cd335d6/data/GPL10333.rda: truncated gzip input
tar.exe: Error exit delayed from previous errors.
Error: Failed to install 'idmap2' from GitHub:
  Does not appear to be an R package (no DESCRIPTION)
In addition: Warning messages:
1: In utils::untar(tarfile, ...) :
  ‘tar.exe -xf "C:\Users\ljx\AppData\Local\Temp\Rtmp4yLw2n\filea2c30364ca.tar.gz" -C "C:/Users/ljx/AppData/Local/Temp/Rtmp4yLw2n/remotesa2c439e24db"’ returned error code 1
2: In system(cmd, intern = TRUE) :
  running command 'tar.exe -tf "C:\Users\ljx\AppData\Local\Temp\Rtmp4yLw2n\filea2c30364ca.tar.gz"' had status 1

今天花费了两个多小时才解决,尝试了如下的方法:

install_github("jmzeng1314/idmap2")

library(idmap2)
BiocManager::install('githubinstall')
library(githubinstall)

githubinstall("jmzeng1314/idmap2")
devtools::install_github("jmzeng1314/idmap2", subdir = "pkg")
devtools::install_github('jmzeng1314/idmap2')
idmap2 = devtools:::source_pkg("idmap2-master")
install(idmap2)
githubinstall("idmap2")
githubinstall::idmap2
githubinstall::githubinstall("idmap2")

以上安装全部失败。

四、终极解决办法:本地安装

终极解决办法:本地安装

devtools::install_local("idmap2.zip")
> devtools::install_local("idmap2.zip")

Installing package into ‘C:/Users/ljx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'idmap2' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'idmap2'
    finding HTML links ... done
    get_soft_IDs                            html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (idmap2)

安装成功

> library(idmap2)

idmap2 v 0.1.0  welcome to use idmap2!
If you use idmap2 in published research, please acknowledgements:
We thank Dr.Jianming Zeng(University of Macau), and all the members of his bioinformatics team, biotrainee, for generously sharing their experience and codes.
上一篇下一篇

猜你喜欢

热点阅读