简体   繁体   English

无法为 R 4.1 安装 R 包

[英]Unable to install R packages for R 4.1

I am unable to install any R packages today.我今天无法安装任何 R 包。 The issue did not happen until last week (the last time I use the command).直到上周(我最后一次使用该命令时)才出现该问题。 My laptop system is a Windows 10, and I am not using any local network/proxy/work Internet, so pretty sure it is not the proxy server or firewall issue.我的笔记本电脑系统是 Windows 10,我没有使用任何本地网络/代理/工作互联网,所以很确定这不是代理服务器或防火墙问题。 I updated my R, restart the program and the computer, no help.我更新了我的 R,重新启动程序和计算机,没有帮助。

Here is the error message.这是错误消息。

Warning in install.packages : unable to access index for repository http://cran.rstudio.com/src/contrib : cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES' install.packages 中的警告:无法访问存储库http://cran.rstudio.com/src/contrib 的索引:无法打开 URL 'http://cran.rstudio.com/src/contrib/PACKAGES'

Here are the methods I have tried from the Internet but did NOT work:以下是我从互联网上尝试过但没有奏效的方法:

  1. Update the CRAN Repository for installing packages更新 CRAN 存储库以安装软件包
  2. Uncheck the "Use secure download method for HTTP" and "Use Internet Explorer library/proxy for HTTP" options取消选中“对 HTTP 使用安全下载方法”和“对 HTTP 使用 Internet Explorer 库/代理”选项
  3. Run R as administrator以管理员身份运行 R
  4. Change the library to install packages更改库以安装包
  5. Use the install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')使用install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')

Again, I am pretty sure there is no firewall/proxy issue, as I never had the problem until last week, using the same Internet and the same device.同样,我很确定没有防火墙/代理问题,因为直到上周我才遇到问题,使用相同的互联网和相同的设备。 Does anyone have ideas?有没有人有想法? Thanks in advance for the help!在此先感谢您的帮助!

The issue was eventually solved by options(download.file.method="libcurl") .该问题最终由options(download.file.method="libcurl")

Following another suggested answer, I tried options(repos = "http://cran.rstudio.com/") but got the below message:按照另一个建议的答案,我尝试了options(repos = "http://cran.rstudio.com/")但收到以下消息:

Warning message: In download.file(mirrors_csv_url, destfile = mirrors_csv, quiet = TRUE) : InternetOpenUrl failed: 'ìÂs°þ$'警告消息:在 download.file(mirrors_csv_url, destfile = mirrors_csv, quiet = TRUE) 中:InternetOpenUrl 失败:'ìÂs°þ$'

Then the answer to this question did the trick.那么这个问题的答案就成功了。

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

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