我最近在个人计算机(Windows 8)上安装了R Studio(版本0.99.892),并尝试安装以下软件包: GGPLOT2; dplyr; rmarkdown; tidyr。
R和R Studio都无法安装任何这些软件包。每次我尝试安装软件包时,都会收到我在此帖子底部包含的警告集。
我使用了install.packages命令以及内置的软件包安装工具。我尝试了几种不同的镜子。
我曾尝试过公立大学的互联网资源,我自己的私人互联网资源和电话系绳。我试图通过VPN连接。我已将R Studio添加到我的Windows防火墙例外列表中,并且还完全禁用了Windows防火墙。我没有运行其他防火墙。
我在全局选项的“包”选项卡中切换了各种连接选项。
我可以在浏览器中访问这些网址。
以下是R Studio的警告:
> install.packages("devtools")
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/src/contrib:
cannot open URL 'https://cran.fhcrc.org/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
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/Nikhailovich/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/src/contrib:
cannot open URL 'https://cran.fhcrc.org/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
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 :
package ‘devtools’ is not available (for R version 3.2.3)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/bin/windows/contrib/3.2:
cannot open URL 'https://cran.fhcrc.org/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/PACKAGES'
以下是R(3.2.3)的警告:
> install.packages("ggplot2")
Installing package into ‘C:/Users/Nikhailovich/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning: unable to access index for repository https://dirichlet.mat.puc.cl/src/contrib:
cannot open URL 'https://dirichlet.mat.puc.cl/src/contrib/PACKAGES'
Warning: 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: unable to access index for repository https://dirichlet.mat.puc.cl/bin/windows/contrib/3.2:
cannot open URL 'https://dirichlet.mat.puc.cl/bin/windows/contrib/3.2/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/PACKAGES'
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.3)
R和R Studio中的软件包安装上有几个stackexchange帖子,但是我无法找到任何能够解决我特定情况的帖子。提前感谢知道正在发生什么的人
答案 0 :(得分:4)
之前发生在我身上。尝试明确指定位置:
install.packages("devtools", repos="https://cran.rstudio.com/")
答案 1 :(得分:3)
运行此命令:
options(repos="https://CRAN.R-project.org")
之后尝试install.packages;它应该工作。在我的系统上测试。
答案 2 :(得分:2)
使用带有参数install.packages()
的{{1}}函数时,您确实可以指定位置,但您也可以选择每次下载软件包时使用的最喜欢的存储库。
repos=
您可以在CRAN website上看到所有可用镜像的列表。 Juste将最近的CRAN存储库的地址复制/粘贴给您。
您应该可以在此步骤后重试 options(repos="my_favorite_CRAN_mirror")
答案 3 :(得分:1)
您应该尝试以下代码:
install.packages("ggbiplot",dependencies = TRUE, repos = 'http://cran.rstudio.com/')
它将帮助您安装错误的软件包:
软件包不适用于该版本
答案 4 :(得分:0)
I was having a similar error while trying to install the packages dplyr
, tidyr
packages.
I solved the issue by checking my R.version
and downloading a new version of base R. (3.3.3)
答案 5 :(得分:0)
尝试一下...
工具->全局选项->程序包
将“主CRAN存储库”更改为htpps位置
此方法解决了我的问题
答案 6 :(得分:0)
在R终端中运行以下命令- 选项(repos =“ https://CRAN.R-project.org”) 然后- use-install.packages('library')
答案 7 :(得分:0)
我想补充一点,我遇到了这个问题,但修复不是在 R 中,而是在我们的系统中。我们的 IT 人员说:由于某种未知原因,DNS 解析器服务无法解析主机名。我已经重新启动了 resolvd 服务。服务器现在可以解析主机名。
他那边的错误是:名称解析暂时失败