R 更新后无法安装包:无法访问存储库索引:无法加载 Internet 例程

Unable to install packages after R update: unable to access index for repository: internet routines cannot be loaded

我用的是RStudio,昨天把R更新到以下版本:

R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

现在,我无法连接到任何 CRAN 镜像(我尝试了 4 个不同的)或安装包。当我启动 RStudio 时,出现以下错误:

Error in tools::startDynamicHelp() : internet routines cannot be loaded
Warning: namespace ‘lme4’ is not available and has been replaced
by .GlobalEnv when processing object ‘lmer1’
Warning: namespace ‘ggplot2’ is not available and has been replaced
by .GlobalEnv when processing object ‘plot1’
Warning: namespace ‘emmeans’ is not available and has been replaced
by .GlobalEnv when processing object ‘.Last.ref_grid’
Warning: namespace ‘pbkrtest’ is not available and has been replaced
by .GlobalEnv when processing object ‘.Last.ref_grid’
[Workspace loaded from C:/Users/xxx.RData]

Loading required package: lmerTest
Loading required package: lme4
Loading required package: Matrix
Error: package or namespace load failed for ‘lme4’:
 package ‘lme4’ was installed before R 4.0.0: please re-install it
Failed with error:  ‘package ‘lme4’ could not be loaded’

然后,当我尝试安装软件包时,收到以下消息:

Installing package into ‘C:/Users/xxx/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/src/contrib:
  internet routines cannot be loaded
Warning in install.packages :
  package ‘Rtools’ is not available (for R version 4.0.0)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/4.0:
  internet routines cannot be loaded

我知道这些警告有多个线程,但我还没有找到任何一个解决这个问题的方法。 我已经尝试过但没有奏效的事情:

我的伙伴在他的计算机上下载了 R 4.0 和 RStudio,并且运行良好。

有什么建议吗?我是 Stack Overflow 的新手,也是 R 的新手,所以请在可能的情况下逐步 instructions/suggestions!

我遇到了类似的问题。我在启动时收到以下错误

Error in tools::startDynamicHelp() : internet routines cannot be loaded

经过调查,我发现我的杀毒软件已经被隔离R-4.0.0/modules/x64/internet.dll。不幸的是,我的防病毒设置受组策略控制,因此我无法禁用它们以寻求解决方案。

因此,在 4 phone 次调用和多次尝试解决此问题后,我所在机构的 IT 部门今天能够禁用阻止 R 和 R Studio 工作的防病毒块。

显然,为了避免将来出现这种情况,我需要 运行 来自特定文件夹的新程序。所以毕竟是防病毒软件,但我有一台工作电脑,无法从我这边更改设置。

我可以确认 modules\x64\internet.dll 在我的工作电脑上被 symantec 隔离了。这是主要问题。我会打电话给我的 IT 部门修复并更新结果。

我通过 运行 [每次]:

解决了这个问题

options(download.file.method="wget")

Install RStudio and R Version With help of IT Team.

Download New Version of R from CRAN

Copy an internet.dll file (which Size should be Up to 5MB) from Existing Version Installed by IT Team on Your System

C:\Program Files\R\R-4.0.3\modules\x64 and

Paste it to C:\Users\MyUser\Documents\R\R-4.1.2\modules\x64 folder of New version

Then Restart RStudio you will not get any error

also you can install any packages

Do not need to make changes into any File like Rprofile and Renv

Or any other Options() Functions

Note: The File Path may be different in your System

在工作机器上远程工作,我们最近发现在尝试安装软件包时连接到 VPN 会产生同样的错误,并经历了与上述类似的故障排除过程。在我们的例子中,断开与 VPN 的连接解决了问题,我们能够成功继续调用 install.packages()。

我怀疑 VPN 正在与安装 R 的文件夹上的防火墙设置进行交互。添加此解决方案以防它与其他任何人的情况相关。