安装了差不多一个下午加一个早上才找到原因安装上。
总结了一下,可能是安装版本的问题,
一:开始安装的时候,是直接在Rstudio右侧的package下install的seurat,但library(Seurat)后显示错误:
Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
不存在叫‘RcppAnnoy’这个名字的程辑包
In addition: Warning message:
程辑包‘Seurat’是用R版本3.6.3 来建造的
二:但install.packages("RcppAnnoy")后又出现错误
c:/Rtools/mingw_64/bin/g++ -std=gnu++11 -I"D:/PROGRA~3/R/R-36~1.1/include" -DNDEBUG -I../inst/include/ -I"D:/Program Files/R/R-3.6.1/library/Rcpp/include" -O2 -Wall -mtune=generic -c RcppExports.cpp -o RcppExports.o
sh: c:/Rtools/mingw_64/bin/g++: No such file or directory
make: *** [D:/PROGRA~3/R/R-36~1.1/etc/x64/Makeconf:215: RcppExports.o] Error 127
ERROR: compilation failed for package 'RcppAnnoy'
* removing 'D:/Program Files/R/R-3.6.1/library/RcppAnnoy'
Warning in install.packages :
installation of package ‘RcppAnnoy’ had non-zero exit status
三:百度和一下说是没有安装g++,所以又安装install.packages("BiocManager")
BiocManager::install("g++"),再library(Seurat),还是报同样的错误,来回试了几次,R版本也改成3.5.3,可还是不行。
四:放了一晚上,早上再自己看了一下,觉得可能是因为直接install.packages("RcppAnnoy")或install.packages("Seurat")的包依赖的是linux的系统,但我是windows的。
get到这个点后,我就在CRAN - Package RcppAnnoy网站上将Windows binaries:r-release: RcppAnnoy_0.0.15.zip下载到本地,然后在Rstudio中选择本地安装 install.packages("D:/Program Files/RStudio/Pachage/RcppAnnoy_0.0.15.zip", repos = NULL, type = "win.binary"),即显示package ‘RcppAnnoy’ successfully unpacked and MD5 sums checked安装成功。
五:但library(Seurat)后
又显示:No non-system installation of Python could be found.
Would you like to download and install Miniconda?
Miniconda is an open source environment management system for Python.
See https://docs.conda.io/en/latest/miniconda.html for more details.
Would you like to install Miniconda? [Y/n]: Y
* Downloading "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" ...
trying URL 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe'
Warning messages:
1: 程辑包‘Seurat’是用R版本3.6.3 来建造的
2: In download.file(url, destfile = installer, mode = "wb") :
InternetOpenUrl failed: '与服务器的连接意外终止'
我就去miniconda的官网下载了windows版本的,然后又重新安装miniconda,再library(Seurat)就显示正常了。
六:因为我之前已在电脑上安装过 anaconda,但是想这和miniconda有啥不一样吗,就查了一下,附链接:https://github.com/rstudio/reticulate/issues/607有同样疑问的可以看看。