renv:restore()在windows中总是失败

renv:restore()在windows中总是失败,r,renv,r-environment,R,Renv,R Environment,每当我想在我的windows计算机上使用renv:restore()重新创建项目时,安装软件包总是失败。我总是会遇到相同的错误(尽管包可能会更改): 这是我的会话信息: > sessionInfo() R version 4.0.5 (2021-03-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042) Matrix products: default loca

每当我想在我的windows计算机上使用
renv:restore()
重新创建项目时,安装软件包总是失败。我总是会遇到相同的错误(尽管包可能会更改):

这是我的会话信息:

> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.5 tools_4.0.5    renv_0.12.0   
这可能也很有用:

> getOption("download.file.method")
[1] "wininet"
> renv:::renv_download_file_method()
[1] "curl"
>
运行后:
Sys.setenv(RENV\u DOWNLOAD\u METHOD=“curl”)
(或
wininet
libcurl
)我总是得到与以前相同的错误

作为解决办法,我做了以下工作:

  • 关闭项目
  • 正常安装软件包(不带renv)
  • 使用renv打开项目
  • 恢复快照
  • 如果以前安装过这些软件包,它们将被符号链接,并且可以正常工作


    不幸的是,这非常麻烦,因为许多软件包都有依赖项,我必须手动安装它们,这正是我想要避免的事情之一,也是使用renv的原因之一

    为了便于记录:在遵循了来自的这个答案后,我设法使它起作用:

  • 更新
    renv
    至最新版本(当前为0.13.2)
  • 运行Sys.setenv(RENV\u DOWNLOAD\u METHOD=“wininet”)
  • 运行
    renv::restore()

  • 如果您将问题交叉发布到多个位置,请明确说明您正在这样做:
    > getOption("download.file.method")
    [1] "wininet"
    > renv:::renv_download_file_method()
    [1] "curl"
    >