BiocManager不能安装包,显示Bioconductor version cannot be validated; no internet connection,不能联网 解决方法

可以使用install.packages安装包,但不能使用BiocManager::install(“”)安装包,显示Bioconductor version cannot be validated; no internet connection , URL ‘https://bioconductor.org/config.yaml’: status was ‘SSL connect error’. 使用BiocManager::valid()也同样出现这样的问题。

尝试了很多方法都无效:

  1. 关闭防火墙,无效;
  2. 更换镜像,无效;
    options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
    options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")
  3. 由于我的电脑是win7系统,以为是版本不兼容,从R4.0试到了R4.2.3,无效;
  4. 以为是Rstudio版本的问题,单独在不同版本的R中试,无效;
  5. 设置R里HTTP选项,R里 Tools -> Global Options ->Packages and unchecking the ->”Use Internet Explorer library/proxy for HTTP”option, 也无效;
  6. 设置下载方式,无效;
options(download.file.method = 'libcurl')
options(url.method='libcurl')

后来仔细查看报错信息,可能是无法连接到config.yaml配置文件导致的,在“https://bioconductor.org/config.yaml”中下载了配置文件到自己的电脑,然后指定这个配置文件,果然就搞定了。

options(
  BIOCONDUCTOR_CONFIG_FILE = "D:/Program Files/R/R-4.2.3/config.yaml"
)