R | R包安装报错-github连接速度慢或无法访问 | metaboanalystR | Retip | rJava安装

一、metaboanalystR 安装

Error: Bioconductor version cannot be validated; no internet connection?-2019-06-19
BiocManager安装R包失败——Bioconductor version cannot be validated
Windows电脑使用Rstudio会有多少错误呢

1.1 Bioconductor报错,无网络连接

报错问题:

Error: Bioconductor version cannot be validated; no internet connection?  See #troubleshooting section in vignette
pacman::p_load(c("impute", "pcaMethods", "globaltest", "GlobalAncova", "Rgraphviz", "preprocessCore", "genefilter", "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", "MSnbase", "multtest","RBGL","edgeR","fgsea","httr","qs"))
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
Warning: 无法在貯藏處http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/4.3中读写索引:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/4.3/PACKAGES'
trying URL 'https://bioconductor.org/packages/3.17/bioc/bin/windows/contrib/4.3/BiocVersion_3.17.1.zip'
Content type 'application/zip' length 8264 bytes
downloaded 8264 bytes

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

1.2 github520-修改hosts文件

metaboanalystR
百度搜索github520
修改host文件

安装metaboanalystR,首先需要手动安装依赖包SSPA,但安装不成功。

解决方法

找到系统中的hosts 文件
Windows 系统:C:\Windows\System32\drivers\etc\hosts

以文本形式打开hosts 文件,图片中为笔者2023-11-8修改
在这里插入图片描述

复制Github520信息,并粘贴在上述打开的hosts文件中,保存。

  • 由于是在系统路径下,无法直接保存该文件,可将其先另存到桌面,再从桌面拖到C:\Windows\System32\drivers\etc\hosts路径下,接下来重启RStudio即可正常访问github并下载安装R包了;
  • 该文件内容可能需要定期更新,不能访问github时就可以重复以上操作。
> devtools::install_github("https://github.com/mvaniterson/SSPA")
Downloading GitHub repo mvaniterson/SSPA@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: vctrs (0.6.3 -> 0.6.4) [CRAN]
5: fansi (1.0.4 -> 1.0.5) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
vctrs  (0.6.3 -> 0.6.4 ) [CRAN]
fansi  (1.0.4 -> 1.0.5 ) [CRAN]
qvalue (NA    -> 2.32.0) [CRAN]
Installing 3 packages: vctrs, fansi, qvalue
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
trying URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/vctrs_0.6.4.zip'
Content type 'application/zip' length 1334820 bytes (1.3 MB)
downloaded 1.3 MB

trying URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/fansi_1.0.5.zip'
Content type 'application/zip' length 314105 bytes (306 KB)
downloaded 306 KB

trying URL 'https://bioconductor.org/packages/3.17/bioc/bin/windows/contrib/4.3/qvalue_2.32.0.zip'
Content type 'application/zip' length 2809146 bytes (2.7 MB)
downloaded 2.7 MB

程序包‘vctrs’打开成功,MD5和检查也通过
Warning: 无法将拆除原来安装的程序包‘vctrs’
Warning: 回复了‘vctrs’
程序包‘fansi’打开成功,MD5和检查也通过
程序包‘qvalue’打开成功,MD5和检查也通过

下载的二进制程序包在
	C:\Users\hp\AppData\Local\Temp\RtmpCAEEVQ\downloaded_packages里
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\hp\AppData\Local\Temp\RtmpCAEEVQ\remotes52045d417c\mvaniterson-SSPA-6846d55/DESCRIPTION'
─  preparing 'SSPA':
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a 'data/datalist' file should be added
─  building 'SSPA_2.11.0.tar.gz'
   
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
* installing *source* package 'SSPA' ...
** using staged installation
** libs
using C compiler: 'gcc.exe (GCC) 12.3.0'
gcc  -I"D:/Program Files/R/R-4.3.1/include" -DNDEBUG     -I"D:/Apps install/Rtools/rtools43/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c Rinit.c -o Rinit.o
Rinit.c:8:40: warning: missing braces around initializer [-Wmissing-braces]
    8 | static const R_CMethodDef cMethods[] = {
      |                                        ^
gcc  -I"D:/Program Files/R/R-4.3.1/include" -DNDEBUG     -I"D:/Apps install/Rtools/rtools43/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c massdist.c -o massdist.o
gcc  -I"D:/Program Files/R/R-4.3.1/include" -DNDEBUG     -I"D:/Apps install/Rtools/rtools43/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c nncg.c -o nncg.o
nncg.c: In function 'objf':
nncg.c:57:11: warning: '*c[0]' may be used uninitialized [-Wmaybe-uninitialized]
   57 |   return(c[0]);
      |         ~~^~~~
gcc -shared -s -static-libgcc -o SSPA.dll tmp.def Rinit.o massdist.o nncg.o -LD:/Apps install/Rtools/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 -LD:/Apps install/Rtools/rtools43/x86_64-w64-mingw32.static.posix/lib -LD:/Program Files/R/R-4.3.1/bin/x64 -lR
installing to C:/Users/hp/AppData/Local/R/win-library/4.3/00LOCK-SSPA/00new/SSPA/libs/x64
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** 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 (SSPA)
Warning message:
In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\hp\AppData\Local\R\win-library\4.3\00LOCK\vctrs\libs\x64\vctrs.dll to C:\Users\hp\AppData\Local\R\win-library\4.3\vctrs\libs\x64\vctrs.dll: Permission denied

在这里插入图片描述

在这里插入图片描述
安装metaboanalystR,
在这里插入图片描述
在这里插入图片描述

问题:未安装R包“crmn”,手动安装后,再本地安装“metaboanalystR”,安装成功。
在这里插入图片描述
在这里插入图片描述

二、retip安装

R语言rJava包安装载入及JAVA环境配置
R:xlsx/rJava无法加载的解决方法——java安装及版本查询

2.1 rJava包加载报错及安装

> devtools::install_github("https://github.com/PaoloBnn/Retip")
Downloading GitHub repo PaoloBnn/Retip@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: vctrs (0.6.3 -> 0.6.4) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
vctrs (0.6.3 -> 0.6.4) [CRAN]
Installing 1 packages: vctrs
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
trying URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/vctrs_0.6.4.zip'
Content type 'application/zip' length 1334820 bytes (1.3 MB)
downloaded 1.3 MB

程序包‘vctrs’打开成功,MD5和检查也通过
Warning: 无法将拆除原来安装的程序包‘vctrs’
Warning: 回复了‘vctrs’

下载的二进制程序包在
	C:\Users\hp\AppData\Local\Temp\Rtmp0WG2OO\downloaded_packages里
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\hp\AppData\Local\Temp\Rtmp0WG2OO\remotes47e451515493\PaoloBnn-Retip-8c23eda/DESCRIPTION' ...
─  preparing 'Retip':
✔  checking DESCRIPTION meta-information ... 
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building 'Retip_0.5.4.tar.gz'
   
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
* installing *source* package 'Retip' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error: .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry
Execution halted
ERROR: lazy loading failed for package 'Retip'
* removing 'C:/Users/hp/AppData/Local/R/win-library/4.3/Retip'
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\hp\AppData\Local\R\win-library\4.3\00LOCK\vctrs\libs\x64\vctrs.dll to C:\Users\hp\AppData\Local\R\win-library\4.3\vctrs\libs\x64\vctrs.dll: Permission denied
2: In i.p(...) :
  安装程序包‘C:/Users/hp/AppData/Local/Temp/Rtmp0WG2OO/file47e461ac715c/Retip_0.5.4.tar.gz’时退出狀態的值不是0
> install.packages("rJava")
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
trying URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/rJava_1.0-6.zip'
Content type 'application/zip' length 1300490 bytes (1.2 MB)
downloaded 1.2 MB

程序包‘rJava’打开成功,MD5和检查也通过

下载的二进制程序包在
	C:\Users\hp\AppData\Local\Temp\Rtmp0WG2OO\downloaded_packages里
> library(rJava)
Error: package or namespace load failed for ‘rJava’:
 loadNamespace()里算'rJava'时.onLoad失败了,详细内容:
  调用: fun(libname, pkgname)
  错误: JAVA_HOME cannot be determined from the Registry

在这里插入图片描述
在这里插入图片描述

Windows10下的超详细Java安装步骤
Java/JDK下载安装与环境配置(Windows 10 超详细的图文版教程 )

根据以上链接,首先安装Java,并进行环境配置。
在这里插入图片描述

以上,加载rJava包成功。

2.2 安装Retip包

> devtools::install_github("https://github.com/PaoloBnn/Retip")
Downloading GitHub repo PaoloBnn/Retip@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: vctrs (0.6.3 -> 0.6.4) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
vctrs (0.6.3 -> 0.6.4) [CRAN]
Installing 1 packages: vctrs
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
trying URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/vctrs_0.6.4.zip'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/vctrs_0.6.4.zip'
In addition: Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
  URL 'https://mirrors.sjtug.sjtu.edu.cn/cran/bin/windows/contrib/4.3/vctrs_0.6.4.zip': status was 'Couldn't resolve host name'
Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
  下载程序包‘vctrs’时出了问题
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\hp\AppData\Local\Temp\Rtmp0WG2OO\remotes47e4440c7b54\PaoloBnn-Retip-8c23eda/DESCRIPTION' (793ms)
─  preparing 'Retip':
✔  checking DESCRIPTION meta-information ... 
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building 'Retip_0.5.4.tar.gz'
   
将程序包安装入‘C:/Users/hp/AppData/Local/R/win-library/4.3’
(因为‘lib’没有被指定)
* installing *source* package 'Retip' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** 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 (Retip)

安装成功。

三、从Bioconductor安装Rdisop报错及解决方式

从Bioconductor安装R包报错,网络未连接:

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

BiocManager::install("Rdisop")

Error: Bioconductor version cannot be validated; no internet connection? See #troubleshooting section in vignette
>options(download.file.method = 'libcurl')  #问题解决

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

BiocManager::install("Rdisop")

BiocManager无法安装R包

四、Bioconductor安装报错总结

  • 重启软件及电脑
  • 修改host文件
  • 安装java

猜你喜欢

转载自blog.csdn.net/qq_43210428/article/details/133907696