简体   繁体   English

R: install.packages 错误

[英]R: install.packages error

I'm just trying to simply install a package, and the whole thing is FUBAR.我只是想简单地安装一个包,整个过程就是 FUBAR。 Worked fine earlier this week.本周早些时候工作正常。 Haven't touched firewall settings or anything, and have tried to install both "readxl" and "dplyr" (dplyr just to test if the problem was the readxl package) on two separate machines on two separate networks, with the problem persisting.没有触及防火墙设置或任何东西,并尝试在两个不同网络的两台不同机器上安装“readxl”和“dplyr”(dplyr 只是为了测试问题是否是 readxl 包),但问题仍然存在。 Tried my home internet (both wifi and hardwire) as well as a mobile hotspot on my cell phone.在我的手机上尝试了我的家庭互联网(wifi 和硬线)以及移动热点。 How do I get it to go back to normal, with downloading and installing packages fast and easy?如何通过快速轻松地下载和安装软件包使其恢复正常?

> install.packages("readxl")
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/grant/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'
trying URL 'http://cran.mtu.edu/bin/windows/contrib/3.4/readxl_1.0.0.zip'
Content type 'application/zip' length 1461628 bytes (1.4 MB)
downloaded 1.4 MB

package ‘readxl’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\grant\AppData\Local\Temp\Rtmpwb6TUN\downloaded_packages

@Kevin, I selected the CRAN mirror in Michigan using chooseCRANmirror, but install.packages still defaulted to the original, bad mirror. @Kevin,我使用chooseCRANmirror 选择了密歇根州的CRAN 镜像,但是install.packages 仍然默认为原始的坏镜像。

> chooseCRANmirror(local.only = TRUE)
Secure CRAN mirrors 

 1: 0-Cloud [https]                 2: Australia (Canberra) [https]    3: Australia (Melbourne) [https]
 4: Australia (Perth) [https]       5: Austria [https]                 6: Belgium (Ghent) [https]      
 7: Brazil (RJ) [https]             8: Brazil (SP 1) [https]           9: Bulgaria [https]             
10: Chile 1 [https]                11: China (Lanzhou) [https]        12: Colombia (Cali) [https]      
13: Czech Republic [https]         14: Denmark [https]                15: France (Lyon 1) [https]      
16: France (Lyon 2) [https]        17: France (Marseille) [https]     18: France (Montpellier) [https] 
19: France (Paris 2) [https]       20: Germany (Münster) [https]      21: Iceland [https]              
22: Indonesia (Jakarta) [https]    23: Ireland [https]                24: Italy (Padua) [https]        
25: Japan (Tokyo) [https]          26: Malaysia [https]               27: Mexico (Mexico City) [https] 
28: Norway [https]                 29: Philippines [https]            30: Russia (Moscow) [https]      
31: Spain (A Coruña) [https]       32: Spain (Madrid) [https]         33: Sweden [https]               
34: Switzerland [https]            35: UK (Bristol) [https]           36: UK (Cambridge) [https]       
37: UK (London 1) [https]          38: USA (CA 1) [https]             39: USA (KS) [https]             
40: USA (MI 1) [https]             41: USA (TN) [https]               42: USA (TX 1) [https]           
43: USA (TX 2) [https]             44: (other mirrors)                

Selection: 40
> install.packages("dplyr")
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/grant/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'
trying URL 'https://cran.mtu.edu/bin/windows/contrib/3.4/dplyr_0.7.1.zip'
Content type 'application/zip' length 2881930 bytes (2.7 MB)
downloaded 2.7 MB

package ‘dplyr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\grant\AppData\Local\Temp\RtmpQXhfjF\downloaded_packages

My default CRAN mirror has been updated as well, but doesn't seem to have an effect even after restarting RStudio.我的默认 CRAN 镜像也已更新,但即使在重新启动 RStudio 后似乎也没有效果。 当前默认 CRAN 镜像

***** Temporary Fix ***** This code must be run: a) after switching the default CRAN mirror and b) at the start of every session. ***** 临时修复 ***** 必须运行此代码:a) 在切换默认 CRAN 镜像后和 b) 在每个会话开始时。

options(repos = getOption("repos")["CRAN"])

I ran into the same problem and have been working on it all day.我遇到了同样的问题,并且一整天都在研究它。 I tried several different CRAN mirrors and finally this one worked:我尝试了几种不同的 CRAN 镜像,最后这个成功了:

install.packages('readxl', dependencies=TRUE, repos=' https://ftp.ussg.iu.edu/CRAN/ ') install.packages('readxl', dependencies=TRUE, repos=' https://ftp.ussg.iu.edu/CRAN/ ')

Downloads occurred instantly.下载立即发生。

Looks like it's a bug, with a CRANextra mirror baked into the RStudio options, pointing to an unstable destination.看起来这是一个错误,在 RStudio 选项中加入了一个 CRANextra 镜像,指向一个不稳定的目的地。 RStudio is reportedly aware of the issue, confirms it's a bug, and will fix on next release.据报道,RStudio 已经意识到这个问题,确认这是一个错误,并将在下一个版本中修复。

Default CRAN mirror must be changed first, then temp solution must still be run at the beginning of every session.必须先更改默认 CRAN 镜像,然后在每个会话开始时仍必须运行临时解决方案。

options(repos = getOption("repos")["CRAN"])

Related posts:相关文章:

Warning: unable to access index for repository https://www.stats.ox.ac.uk/pub/RWin/src/contrib: 警告:无法访问存储库的索引 https://www.stats.ox.ac.uk/pub/RWin/src/contrib:

Problems with installation R packages 安装R包的问题

Thanks for your help in narrowing the issue, Kevin.感谢您帮助缩小问题范围,凯文。

Try increasing the time out limit (maybe 300 will work instead of 100)尝试增加超时限制(也许 300 而不是 100)

options(timeout=300)选项(超时 = 300)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM