參考:
解決Package is not available (for R version XXX)? - Bioinfarmer - 博客園 (cnblogs.com)
安裝歷史版本的R包 - 簡書 (jianshu.com)
總結(jié)版:
- 無ComplexHeatmap包
- 又提示無GetoptLong包
- 無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")
接著再轉(zhuǎn)頭安裝GetoptLong
install.packages("GetoptLong")
#再安裝ComplexHeatmap
install_github("jokergoo/ComplexHeatmap")
- 無updog、viridis包
install.packages("updog")
install.packages("viridis")
再去安裝binmapr
devtools::install_github("xuzhougeng/binmapr")
啰嗦版:
剛解決了devtools無法安裝朱灿,又出現(xiàn)了通過它安裝binmapr包的問題
首先來看看報(bào)錯(cuò)
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這個(gè)包昧识,那就試試去安裝ComplexHeatmap包
install.packages("ComplexHeatmap")
#又出現(xiàn)報(bào)錯(cuò)
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)
這應(yīng)該是說我的R版本太低了,不支持這個(gè)包555
于是我就去找了這個(gè)吧的官方文檔
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
等啊等跪楞,發(fā)現(xiàn)繼續(xù)報(bào)錯(cuò)
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這個(gè)包
install.packages("GetoptLong")
#繼續(xù)報(bào)錯(cuò)缀去,需要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的話,會(huì)提示不支持R 3.6版本甸祭,最新的rjson僅支持R≥4.0
在R-CRAN上查看歷史版本
Index of /src/contrib/Archive/rjson (r-project.org)
指定版本下載R包有兩種方法
①用devtools
require(devtools)
install_version("rjson", version = "0.2.20", repos = "http://cran.us.r-project.org")
但是這個(gè)方法并不能保證所有情況適用
②源代碼安裝
a.Rstudio操作
#linux上下載相應(yīng)版本的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")
#又報(bào)錯(cuò)了
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)在就去安裝這個(gè)updog包,安裝完后又是少了個(gè)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")安裝
最后赊抖!終于!把它裝好了寨典!