我只是想简单地安装一个包,整个事情都是乱七八糟的。本周早些时候运行良好。没有接触防火墙设置或任何东西,并尝试在两个不同网络上的两台不同机器上同时安装" readxl“和"dplyr”(dplyr只是为了测试问题是否出在readxl包),但问题仍然存在。我尝试了我的家庭互联网(包括wifi和硬线),以及我手机上的移动热点。我如何让它恢复正常,快速而简单地下载和安装软件包?
> 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,我使用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我的默认CRAN镜像也已经更新了,但似乎在重启RStudio之后也没有效果。

*临时修复*此代码必须运行: a)在切换默认CRAN镜像之后,b)在每次会话开始时。
options(repos = getOption("repos")["CRAN"])发布于 2017-07-16 06:53:40
我遇到了同样的问题,并且已经解决了一整天。我尝试了几个不同的CRAN镜像,最后这个起作用了:
install.packages('readxl',dependencies=TRUE,repos='https://ftp.ussg.iu.edu/CRAN/')
下载是即时发生的。
发布于 2017-07-16 13:12:46
看起来像是一个bug,在RStudio选项中烘焙了一个CRANextra镜像,指向一个不稳定的目的地。据报道,RStudio已经意识到了这个问题,并确认这是一个错误,并将在下一个版本中修复。
必须先更改默认的CRAN镜像,然后在每次会话开始时仍必须运行临时解决方案。
options(repos = getOption("repos")["CRAN"])相关帖子:
Warning: unable to access index for repository https://www.stats.ox.ac.uk/pub/RWin/src/contrib:
Problems with installation R packages
谢谢你帮我缩小范围,凯文。
发布于 2021-02-28 08:43:52
尝试增加超时限制(可能是300而不是100)
选项(timeout=300)
https://stackoverflow.com/questions/45114727
复制相似问题