为了匹配新的clusterProfile,我安装了R 4.2版本,继续完成org.Hs.erg.db下载【解决贴】

起因还得看上一个博文,因为反反复复org.Hs.erg.db就是下载不成功,尤其是几个报错的文件,在安装完二进制包,准备载入时却发现,需要R >4.1版本,而我的是R 4.0.5 (已停止更新)

而这个包还有其他的包似乎是装org.Hs.erg.db必须的,尤其是kegg想要使用,必须装最新的R……

所以我加入了……

下载R语言安装包以及安装

首先在官网CRAN-R(点击会通过清华镜像进入)–选择Windows(我是Win10),点击base,进入R 4.2.2版本源文件下载,在这里插入图片描述
点击最醒目的下载
在这里插入图片描述
存到你知道的位置,下载完成后打开在这里插入图片描述
安装到C、D、E盘下,勿放在含有中文名的文件下(可直接按默认的来)
一路确认、下一步即可。

安装完成后,需要导入原来的R包以及更新R包

.libPaths("D:\\Office_Document\\R\\win-library\\4.2")

之后可以将旧库里面的文件全部copy到新的文件夹,之后输入代码更新packages

update.packages(checkBuilt=TRUE, ask=FALSE)

注意,如果不能写入则需要以管理员权限打开

——————另外找到一种省力的改变方法,因为我的原路径就在D盘,而R的安装在C盘,因此可以将原文件如…/win-library/4.0更名为当前版本4.2.
之后按照https://zhuanlan.zhihu.com/p/436016486

1、新建一个初始启动文件

file.edit('~/.Rprofile') #在Rstudio中

2、在.Rprofile文件中写入

#更改R包默认安装路径
 .libPaths("D:/软件安装/R_libaray")   ## 输入你的路径 
 myPaths <- c("D:/软件安装/R_libaray") 
 .libPaths(myPaths)

3、保存.Rprofile文件,关闭。在Rstudio中 Ctrl+Shift+F10 重启R

—————————————————分割线—————————————————————
更新R包后,前面都还挺顺利的,直到——

* installing *source* package 'spatstat.explore' ...
** package 'spatstat.explore' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG     -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c Kborder.c -o Kborder.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: Kborder.o] Error 127
ERROR: compilation failed for package 'spatstat.explore'
* removing 'D:/Office_Document/R/win-library/4.2/spatstat.explore'
* installing *source* package 'MASS' ...
** package 'MASS' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG     -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c MASS.c -o MASS.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: MASS.o] Error 127
ERROR: compilation failed for package 'MASS'
* removing 'D:/Office_Document/R/win-library/4.2/MASS'
* restoring previous 'D:/Office_Document/R/win-library/4.2/MASS'
* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I./rlang/    -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c capture.c -o capture.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: capture.o] Error 127
ERROR: compilation failed for package 'rlang'
* removing 'D:/Office_Document/R/win-library/4.2/rlang'
* restoring previous 'D:/Office_Document/R/win-library/4.2/rlang'
* installing *source* package 'sf' ...
** package 'sf' successfully unpacked and MD5 sums checked
** using staged installation

   **********************************************
   WARNING: this package has a configure script
         It probably needs manual configuration
   **********************************************


** libs
rm -f sf.dll RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_utils.o gdal_write.o geos.o hex.o mdim.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfc-sfg.o signed_area.o stars.o wkb.o zm_range.o
cp -r "c:/rtools42/x86_64-w64-mingw32.static.posix/share/gdal" ../inst/
cp: cannot stat 'c:/rtools42/x86_64-w64-mingw32.static.posix/share/gdal': No such file or directory
make: *** [Makevars.ucrt:11: winlibs] Error 1
ERROR: compilation failed for package 'sf'
* removing 'D:/Office_Document/R/win-library/4.2/sf'
* restoring previous 'D:/Office_Document/R/win-library/4.2/sf'
* installing *source* package 'survival' ...
** package 'survival' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG     -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c agexact.c -o agexact.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: agexact.o] Error 127
ERROR: compilation failed for package 'survival'
* removing 'D:/Office_Document/R/win-library/4.2/survival'
* restoring previous 'D:/Office_Document/R/win-library/4.2/survival'
* installing *source* package 'posterior' ...
** package 'posterior' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace 'rlang' 1.0.2 is already loaded, but >= 1.0.6 is required
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'posterior'
* removing 'D:/Office_Document/R/win-library/4.2/posterior'
* installing *source* package 'lavaan' ...
** package 'lavaan' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (lavaan)
* installing *source* package 'lme4' ...
** package 'lme4' successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'D:/Office_Document/R/win-library/4.2/Rcpp/include' -I'D:/Office_Document/R/win-library/4.2/RcppEigen/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c external.cpp -o external.o
sh: line 1: g++: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:260: external.o] Error 127
ERROR: compilation failed for package 'lme4'
* removing 'D:/Office_Document/R/win-library/4.2/lme4'
* restoring previous 'D:/Office_Document/R/win-library/4.2/lme4'

下载的程序包在
        ‘C:\Users\Mona\AppData\Local\Temp\RtmpklXpdV\downloaded_packages’里
Warning messages:
1: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘gss’时退出狀態的值不是0
2: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘spatstat.explore’时退出狀態的值不是0
3: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘MASS’时退出狀態的值不是0
4: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘rlang’时退出狀態的值不是0
5: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘sf’时退出狀態的值不是0
6: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘survival’时退出狀態的值不是0
7: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘posterior’时退出狀態的值不是0
8: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  安装程序包‘lme4’时退出狀態的值不是0

好的,发现问题,
ERROR: compilation failed for package ‘spatstat.explore’
ERROR: compilation failed for package ‘MASS’
ERROR: compilation failed for package ‘rlang’
ERROR: compilation failed for package ‘sf’
ERROR: compilation failed for package ‘survival’
ERROR: lazy loading failed for package ‘posterior’
ERROR: compilation failed for package ‘lme4’

WARNING: this package has a configure script
         It probably needs manual configuration

R也进行了自动清除,如

* removing 'D:/Office_Document/R/win-library/4.2/spatstat.explore'

其他报错也进行了同样处理。
最后报错时将上面的错误编辑包全部认定为 【退出时状态的值非0】

检查防止安装包的地方,发现各个文件残留,于是手动删除(后来发现,这些旧版本不动也行,真的没必要每次都更新)
在这里插入图片描述
接下来遇到的问题:
现在是全新的版本,然我们来尝试下新版本的安装代码

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("org.Hs.eg.db",dependencies=TRUE)

这回因为官网放的就是最新的,所以下载很快,但遗憾的是……error他永不缺席

* installing *source* package 'org.Hs.eg.db' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for 'AnnotationDbi' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called 'rlang'
Execution halted
ERROR: lazy loading failed for package 'org.Hs.eg.db'
* removing 'D:/Office_Document/R/win-library/4.2/org.Hs.eg.db'

害,不就是先下载依赖包AnnotationDbi吗,来了

BiocManager::install('AnnotationDbi',dependencies=TRUE)

总是出现提示旧的包,询问是否更新

Old packages: 'GO.db', 'MASS', 'survival'

不用管,能不升级就不升级,全none(n)

之后发现缺少rlang包,单独下载,需要更新全选否(none,n)

BiocManager::install('rlang',dependencies=TRUE)

装完rlang之后,再重新本地安装已经下载好了的org.Hs.eg.db_3.16.0.tar.gz包

install.packages("C:/Users/Mona/AppData/Local/Temp/RtmpqU97AT/downloaded_packages/org.Hs.eg.db_3.16.0.tar.gz", repos = NULL, type = "source")

最后,喜报!

* installing *source* package 'org.Hs.eg.db' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (org.Hs.eg.db)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值