无法在CentOS中安装软件包:无法加载Internet例程

前端之家收集整理的这篇文章主要介绍了无法在CentOS中安装软件包:无法加载Internet例程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在更新R后在CentOS上的R中安装软件包时遇到了一些麻烦.下面是我尝试在R中安装软件包时会发生什么的示例:

  1. > install.packages("ggplot2")
  2. Installing package into '/home/albers/R/x86_64-pc-linux-gnu-library/3.2'
  3. (as 'lib' is unspecified)
  4. --- Please select a CRAN mirror for use in this session ---
  5. Error in download.file(url,destfile = f,quiet = TRUE) :
  6. internet routines cannot be loaded
  7. In addition: Warning message:
  8. In download.file(url,quiet = TRUE) :
  9. unable to load shared object '/usr/local/lib64/R/modules//internet.so':
  10. /usr/local/lib64/R/modules//internet.so: undefined symbol: curl_multi_wait
  11. HTTPS CRAN mirror
  12. 1: 0-Cloud [https] 2: Austria [https]
  13. 3: Chile [https] 4: China (Beijing 4) [https]
  14. 5: Colombia (Cali) [https] 6: France (Lyon 2) [https]
  15. 7: France (Paris 2) [https] 8: Germany (Mnster) [https]
  16. 9: Iceland [https] 10: Mexico (Mexico City) [https]
  17. 11: Russia (Moscow) [https] 12: Spain (A Corua) [https]
  18. 13: Switzerland [https] 14: UK (Bristol) [https]
  19. 15: UK (Cambridge) [https] 16: USA (CA 1) [https]
  20. 17: USA (KS) [https] 18: USA (MI 1) [https]
  21. 19: USA (TN) [https] 20: USA (TX) [https]
  22. 21: USA (WA) [https] 22: (HTTP mirrors)
  23. Selection: 1
  24. Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
  25. internet routines cannot be loaded
  26. Warning message:
  27. package 'ggplot2' is not available (for R version 3.2.5)

所以我花了一些时间搜索错误消息.我更新了我现在最新的curl版本:

  1. $curl -V
  2. curl 7.48.0 (x86_64-pc-linux-gnu) libcurl/7.48.0 zlib/1.2.8
  3. Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
  4. Features: IPv6 Largefile libz UnixSockets

仍然无法安装包,并收到相同的错误消息.所以我尝试按照this post的说明,特别是将以下命令添加到我的.bash_profile:

  1. export LD_LIBRARY_PATH=$TOOLS/curl-7.48.0/lib:$LD_LIBRARY_PATH

我再次得到关于R无法加载共享对象的相同错误消息.最终这是一个下载问题,因为download.file也失败了.这是我的sessionInfo():

  1. R version 3.2.5 (2016-04-14)
  2. Platform: x86_64-pc-linux-gnu (64-bit)
  3. Running under: CentOS release 6.2 (Final)
  4. locale:
  5. [1] LC_CTYPE=en_US.iso885915 LC_NUMERIC=C
  6. [3] LC_TIME=en_US.iso885915 LC_COLLATE=en_US.iso885915
  7. [5] LC_MONETARY=en_US.iso885915 LC_MESSAGES=en_US.iso885915
  8. [7] LC_PAPER=en_US.iso885915 LC_NAME=C
  9. [9] LC_ADDRESS=C LC_TELEPHONE=C
  10. [11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C
  11. attached base packages:
  12. [1] stats graphics grDevices utils datasets methods base

我可以使用wget和curl下载文件但是一旦我启动R,我就无法下载任何内容.

有没有人对我如何解决这个问题有任何建议?

最佳答案
试试吧.

  1. install.packages("ggplot2",repos="http://cran.cnr.berkeley.edu")

或者在安装之前将下载工具更改为其他内容,即在Linux上,您可以尝试按如下方式进行操作.

  1. options(download.file.method = "wget")

注意,我已经删除了https for http.我有类似的错误……

  1. Selection: 1
  2. Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
  3. unsupported URL scheme
  4. Warning message:
  5. package ggplot2 is not available (for R version 3.2.3)

如果你从你的问题中查看以下行的输出

  1. Yours
  2. Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
  3. Mine (Also Centos 6)
  4. Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp

您的卷曲缺少https支持.输出中的curl_multi_wait也有错误.这是在7.28.0中添加的.

https://curl.haxx.se/libcurl/c/curl_multi_wait.html

如果你需要在本地构建curl,请执行此操作

  1. mkdir -p $HOME/curl
  2. cd $HOME/curl
  3. git clone https://github.com/curl/curl.git
  4. cd curl
  5. bash buildconf
  6. ./configure --prefix=$HOME/libcurl
  7. make
  8. make install

此时,您需要在.bash_profile中设置LD_LIBRARY_PATH即

  1. export LD_LIBRARY_PATH=$HOME/libcurl/lib:$LD_LIBRARY_PATH

然后退出并再次返回或

  1. source ~/.bash_profile

猜你在找的Linux相关文章