2014-09-01 222 views
44

我无法通过最新版本的RStudio and R Version.3.1.1.安装软件包。我得到了如下所述的错误:无法在最新版本的RStudio和R版本中安装软件包.3.1.1

Example: 
Warning in install.packages : 
    InternetOpenUrl failed: '' 
Warning in install.packages : 
    InternetOpenUrl failed: '' 
Warning in install.packages : 
    unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1 
Installing package into ‘C:/Users/Documents/R/win-library/3.1’ 
(as ‘lib’ is unspecified) 
Warning in install.packages : 
    InternetOpenUrl failed: '' 
Warning in install.packages : 
    InternetOpenUrl failed: '' 
Warning in install.packages : 
    unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1 
Warning in install.packages : 
    package ‘reshape’ is not available (for R version 3.1.1) 
+0

防火墙/代理问题?它之前工作过吗? – 2014-09-01 06:34:42

+1

RStudio支持网站上的响应:https://support.rstudio.com/hc/communities/public/questions/200522573-Can-t-install-packages – Andrie 2015-01-13 14:39:44

+0

我也有这个问题。解决方案是使用另一面镜子。 – Deleet 2015-07-06 00:48:34

回答

6

正如@Pascal所说,很可能您遇到了防火墙或/和代理问题。 作为第一步,请通过FAQ on the CRAN web page。之后,尝试使用--internet2来标记R.

有时候在R studio中检查全局选项并取消选中“使用Internet Explorer库/ HTTP代理”可能很有用。 工具 - >全局选项 - >打包并取消选中“使用Internet Explorer库/ HTTP代理”选项。

希望这会有所帮助。

0

如果您使用的是Windows,试试这个:

"C:\Program Files\RStudio\bin\rstudio.exe" http_proxy=http://host:port/

+0

我在哪里输入这个?内部RStudio或CMD? – 2016-09-23 14:13:56

+0

@Pragyaditya Das键入命令提示符。打开一个:WindowsKey + R>输入“cmd”> Enter。不要忘记用实际的号码替换“主机”和“端口”;-) – 2016-09-23 15:55:18

+0

如何找到主机和端口号? – 2016-09-24 11:31:36

0

我的解决方案,它的工作是开放的R工作室选项,并选择全球miror(场是空的之前)和错误走了。

0

什么工作对我来说:

首选项 - 常规 - 默认的工作目录,浏览切换从全球到本地镜像

在Mac上工作。 10.10.3

98

不是100%肯定,你有同样的问题,但我发现了艰辛的道路,我的工作块是被提供和我得到象这样的错误的每个镜像站点选项:

Installing package into ‘/usr/lib64/R/library’ 
(as ‘lib’ is unspecified) 
--- Please select a CRAN mirror for use in this session --- 
Error in download.file(url, destfile = f, quiet = TRUE) : 
    unsupported URL scheme 
Warning: unable to access index for repository https://rweb.crmda.ku.edu/cran/src/contrib 
Warning message: 
package ‘ggplot2’ is not available (for R version 3.2.2) 

解决方法(我用CentOS的)...

install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/') 

我希望这可以节省挫折有人小时。

+0

奇怪,因为我能够安装软件包没有问题,直到今天早上......但这个工作立即。 – 2015-12-16 15:50:20

+0

另外,请检查您的RProfile中没有设置''''download.file.method'''。 https://support.rstudio.com/hc/en-us/articles/206827897-Secure-Package-Downloads-for-R – polka 2017-05-31 18:49:19

1

请检查以下才能够安装新的软件包:

1-在工具 - >全局选项 - >软件包,取消选择了 “HTTP使用Internet Explorer库/代理”,

2-在工具 - >全局选项 - >包,改变CRAN镜为 “0-云 - Rstudio,自动重定向到全球服务器”

3-重启Rstudio。

4-玩得开心!

4

基于来自社区的答案,似乎有几种方法可以解决这个问题:

  1. official FAQsupport forumsthis answer,你可能有防火墙或代理问题是阻止RStudio从连接到互联网:

    • 禁用任何防火墙
    • 工具 - >全局选项 - >包并取消选中选项,然后重新启动R(#1#2#3
    • R标志与--internet2
    • “使用Internet Explorer库/ HTTP代理” 在CentOS it was suggested尝试以下操作:install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
  2. 几个答案建议使用替代镜(#1#2#3):

    • 首选项>常规>默认工作目录>浏览和切换你的镜子局部/全局(取未选中)
  3. 在Windows上,你可以开始与http_proxy=http://host:port/应用程序:

    • "C:\Program Files\RStudio\bin\rstudio.exe" http_proxy=http://host:port/
  4. 关闭并重新启动。经过上述许多操作后需要,并且suggested standalone

+0

还有一个:如果硬盘上没有更多空间(Windows),则会发生此错误 – mts 2016-01-12 22:40:15

40

,我认为这是在 “设置它和忘记它” 的解决方案:

options(repos='http://cran.rstudio.com/') 

请注意,这不是HTTPS。我在一台Linux机器上ssh'ing。如果我使用https,它不起作用。

+0

我的问题从repos ='https://cran.rstudio.com/'消失... http ... – 2016-04-02 00:37:48

0

@cer解决方案的大部分时间工作,但如果它不工作,然后尝试安装它在基地R(不在R工作室)。由于R studio在后台运行基本R可执行文件,所以新的软件包也将在R studio中可用。 [我在macOS上的体验]

相关问题