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

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
相关推荐
学习使我变快乐1 小时前
C++:const成员
开发语言·c++
西柚与蓝莓2 小时前
任务【浦语提示词工程实践】
github
500了2 小时前
Kotlin基本知识
android·开发语言·kotlin
不知所云,4 小时前
qt cmake自定义资源目录,手动加载资源(图片, qss文件)
开发语言·qt
安冬的码畜日常4 小时前
【玩转 JS 函数式编程_006】2.2 小试牛刀:用函数式编程(FP)实现事件只触发一次
开发语言·前端·javascript·函数式编程·tdd·fp·jasmine
阑梦清川4 小时前
Java继承、final/protected说明、super/this辨析
java·开发语言
PythonFun5 小时前
Python批量下载PPT模块并实现自动解压
开发语言·python·powerpoint
Death2005 小时前
Qt 6 相比 Qt 5 的主要提升与更新
开发语言·c++·qt·交互·数据可视化
机器视觉知识推荐、就业指导5 小时前
使用Qt实现实时数据动态绘制的折线图示例
开发语言·qt
快乐就好ya6 小时前
Java多线程
java·开发语言