【问题标题】:Warning: unable to access index for repository internet routines cannot be loaded警告:无法访问存储库 Internet 例程的索引,无法加载
【发布时间】:2016-06-16 17:45:50
【问题描述】:

三天前,我可以在三个不同的系统上毫无问题地安装软件包。 R 在所有三个系统上都进行了重建(Gentoo 强制重建),现在我无法从 CRAN 下载和安装它们中的任何一个......

> install.packages('rmarkdown')
Warning: unable to access index for repository https://r-forge.r-project.org/src/contrib:
  internet routines cannot be loaded
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
  internet routines cannot be loaded
Warning: unable to access index for repository https://cran.uk.r-project.org/src/contrib:
  internet routines cannot be loaded

这是我在.Rprofile...中定义的三个存储库...

## Set CRAN mirrors
local({r <- getOption("repos"); r["CRAN"] <- "https://cran.uk.r-project.org"; options(repos=r)})
options(repos=c(RStudio='https://rstudio.org/_packages', getOption('repos')))
options(repos=c(RStudio='https://cran.rstudio.com/', getOption('repos')))

关于完整信息..

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Gentoo/Linux

locale:
 [1] LC_CTYPE=en_GB.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_GB.utf8        LC_COLLATE=en_GB.utf8    
 [5] LC_MONETARY=en_GB.utf8    LC_MESSAGES=en_GB.utf8   
 [7] LC_PAPER=en_GB.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_1.10.0

loaded via a namespace (and not attached):
[1] memoise_1.0.0 digest_0.6.9 

搜索我找到了几个关于此的主题。前两个只是镜像关闭或错误指定的地方,因为不支持 https...

...这两个都不是问题,因为我使用的是已启动的镜像 (e.g.)。然后我遇到了以下两个线程(一个引用另一个)...

还提到了去年 11 月的 thread on R-help

阅读这些似乎问题可能是几件事之一......

  • LD_LIBRARY_PATH 未在我的系统环境中设置的问题。
  • SSL 支持存在问题。

LD_LIBRARY_PATH 的问题

检查一下我的三个系统...

> Sys.getenv("LD_LIBRARY_PATH")
[1] "/usr/lib64/R/lib:/usr/lib64/blas/reference:/usr/lib64/lapack/reference"
> Sys.getenv("LD_LIBRARY_PATH")
[1] "/usr/lib64/R/lib:/usr/lib64/blas/reference:/usr/lib64/lapack/reference:/etc/java-config-2/current-system-vm/jre/lib/amd64/server"
> Sys.getenv("LD_LIBRARY_PATH")
[1] "/usr/lib64/R/lib:/usr/lib64/blas/reference:/usr/lib64/lapack/reference:/etc/java-config-2/current-system-vm/jre/lib/amd64/server"

所以 R 可以找到自己的库。这表明它可能是 SSL 支持的另一个问题

SSL 支持问题

我发现其他人遇到了这个问题(请参阅here),所以我检查了 Curl 是否可以访问这些 URL 并因此支持 SSL...

# curl https://cran.rstudio.com/src/contrib/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
 <head>
  <title>Index of /src/contrib</title>
 </head>
 <body>
<h1>Index of /src/contrib</h1>
<table><tr><th><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th></tr>
<tr><td valign="top"><img src="/icons/back.gif" alt="[DIR]"></td><td><a href="/src/">Parent Directory</a></td><td>&nbsp;</td><td align="right">  - </td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/folder.gif" alt="[DIR]"></td><td><a href="00Archive/">00Archive/</a></td><td align="right">03-Mar-2016 04:50  </td><td align="right">  - </td><td>&nbsp;</td></tr>
....

所以看起来 Curl 工作正常,我可以访问 URL,但 R 不能。

欢迎任何有关如何解决此问题的指示,因为我无法弄清楚。

提前致谢。

【问题讨论】:

    标签: r


    【解决方案1】:

    我尝试使用 R --vanilla(建议使用 earlier post on R-help)开始一个普通的 R 会话,它揭示了更多信息......

    # R --vanilla
    
    R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
    Copyright (C) 2015 The R Foundation for Statistical Computing
    Platform: x86_64-pc-linux-gnu (64-bit)
    
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.
    
      Natural language support but running in an English locale
    
    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.
    
    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.
    
    > install.packages('rmarkdown')
    --- Please select a CRAN mirror for use in this session ---
    Error in download.file(url, destfile = f, quiet = TRUE) : 
      internet routines cannot be loaded
    In addition: Warning message:
    In download.file(url, destfile = f, quiet = TRUE) :
      unable to load shared object '/usr/lib64/R/modules//internet.so':
      /usr/lib64/libcurl.so.4: undefined symbol: SSLv2_client_method
    Error in file(file, "rt") : cannot open the connection
    In addition: Warning message:
    In file(file, "rt") :
      cannot open file '/usr/share/doc/R-3.2.3/CRAN_mirrors.csv': No such file or directory
    

    因此,我从源代码重建了 net-misc/curl-7.47.1dev-lang/R-3.2.3 并解决了问题。

    【讨论】:

    • 我在这里遇到了类似的情况,除了我的未定义符号是这样的:unable to load shared object '/usr/local/lib64/R/modules//internet.so': /usr/local/lib64/R/modules//internet.so: undefined symbol: curl_multi_wait。您能否提供更多有关如何重建 R 和 curl 的详细信息?我刚刚安装了 R 并构建了 curl,所以我想知道重建命令是否有任何导入。
    • 当然,我用的是Gentoo,所以所有的包都是从源代码安装的。在 Gentoo 下,我只需运行 emerge =net-misc/curl-7.47.1 =dev-lang/R-3.2.3 即可重建并安装这两个包。
    猜你喜欢
    • 1970-01-01
    • 2020-08-16
    • 2017-12-19
    • 2016-11-07
    • 1970-01-01
    • 2020-05-14
    • 2013-09-05
    • 2011-09-25
    • 2017-09-05
    相关资源
    最近更新 更多