R-devtools無法安裝binmapr包

參考:
解決Package is not available (for R version XXX)? - Bioinfarmer - 博客園 (cnblogs.com)
安裝歷史版本的R包 - 簡書 (jianshu.com)

總結版:

  1. 無ComplexHeatmap包
  2. 又提示無GetoptLong包
  3. 無rjson包(R版本過低<3.6>,最新rjson僅支持R≥4.0)
#①devtools指定版本安裝
require(devtools)
install_version("rjson", version = "0.2.20", repos = "http://cran.us.r-project.org")
#②用源代碼安裝
packageurl <- "https://cran.r-project.org/src/contrib/Archive/rjson/rjson_0.2.20.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

接著再轉頭安裝GetoptLong

install.packages("GetoptLong")
#再安裝ComplexHeatmap
install_github("jokergoo/ComplexHeatmap")
  1. 無updog、viridis包
install.packages("updog")
install.packages("viridis")

再去安裝binmapr

devtools::install_github("xuzhougeng/binmapr")

啰嗦版:

剛解決了devtools無法安裝,又出現(xiàn)了通過它安裝binmapr包的問題
首先來看看報錯

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘ComplexHeatmap’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package ‘binmapr’
* removing ‘/data/kesimin/R/x86_64-pc-linux-gnu-library/3.6/binmapr’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpxzWeiv/file7be4b54b4ca1c/binmapr_0.2.tar.gz’ had non-zero exit status

可以看到顯示說沒有ComplexHeatmap這個包,那就試試去安裝ComplexHeatmap包

install.packages("ComplexHeatmap")
#又出現(xiàn)報錯
Installing package into ‘/data/kesimin/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ComplexHeatmap’ is not available (for R version 3.6.3)

這應該是說我的R版本太低了,不支持這個包555
于是我就去找了這個吧的官方文檔
ComplexHeatmap Complete Reference (jokergoo.github.io)
上面推薦的安裝方式是用devtools安裝

library(devtools)
install_github("jokergoo/ComplexHeatmap")

安裝過程中提示我需要update

Downloading GitHub repo jokergoo/ComplexHeatmap@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                             
2: CRAN packages only              
3: None                            
4: digest (0.6.27 -> 0.6.29) [CRAN]
#根據(jù)提示,輸入1
Enter one or more numbers, or an empty line to skip updates: 1
updates

等啊等,發(fā)現(xiàn)繼續(xù)報錯

Installing package into ‘/data/xxx/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
ERROR: dependency ‘GetoptLong’ is not available for package ‘ComplexHeatmap’
* removing ‘/data/kesimin/R/x86_64-pc-linux-gnu-library/3.6/ComplexHeatmap’
Warning messages:
1: package ‘rjson’ is not available (for R version 3.6.3) 
2: In i.p(...) :
  installation of package ‘GetoptLong’ had non-zero exit status
3: In i.p(...) :
  installation of package ‘/tmp/RtmpxzWeiv/file7be4b4932f0d2/ComplexHeatmap_2.11.2.tar.gz’ had non-zero exit status

我們現(xiàn)在需要下載的是GetoptLong這個包

install.packages("GetoptLong")
#繼續(xù)報錯,需要rjson包
Installing package into ‘/data/kesimin/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘rjson’ is not available
trying URL 'https://cloud.r-project.org/src/contrib/GetoptLong_1.0.5.tar.gz'
Content type 'application/x-gzip' length 767681 bytes (749 KB)
==================================================
downloaded 749 KB

ERROR: dependency ‘rjson’ is not available for package ‘GetoptLong’
* removing ‘/data/kesimin/R/x86_64-pc-linux-gnu-library/3.6/GetoptLong’
Warning in install.packages :
  installation of package ‘GetoptLong’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpxzWeiv/downloaded_packages’

由于直接install.packages的話,會提示不支持R 3.6版本,最新的rjson僅支持R≥4.0

rjson

在R-CRAN上查看歷史版本
Index of /src/contrib/Archive/rjson (r-project.org)
rjson-history

指定版本下載R包有兩種方法
①用devtools

require(devtools)
install_version("rjson", version = "0.2.20", repos = "http://cran.us.r-project.org")

但是這個方法并不能保證所有情況適用
②源代碼安裝
a.Rstudio操作

#linux上下載相應版本的rjson包文件
wget https://cran.r-project.org/src/contrib/Archive/rjson/rjson_0.2.20.tar.gz

Rstudio-server上,tools→install packages→Browse,選擇下載的文件→install


源代碼安裝

b.命令行操作

packageurl <- "https://cran.r-project.org/src/contrib/Archive/rjson/rjson_0.2.20.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

rjson安裝成功,現(xiàn)在是安裝GetoptLong

install.packages("GetoptLong")

安裝成功!
接著是ComplexHeatMap

install_github("jokergoo/ComplexHeatmap")

安裝成功!

devtools::install_github("xuzhougeng/binmapr")
#又報錯了
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘updog’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package ‘binmapr’
* removing ‘/xxx/R/x86_64-pc-linux-gnu-library/3.6/binmapr’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpxzWeiv/file7be4b7ca07010/binmapr_0.2.tar.gz’ had non-zero exit status

那我們現(xiàn)在就去安裝這個updog包,安裝完后又是少了個viridis包

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘viridis’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted

啥也別說了,繼續(xù)install.packages("viridis")安裝

最后!終于!把它裝好了!


binmapr
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容