renv:restore() 在 windows 中总是失败
renv:restore() always fails in windows
每当我想使用 renv:restore()
在我的 windows 机器上重新创建一个项目时,安装包总是失败。我总是得到同样的错误(尽管包可能会改变):
Retrieving 'https://cloud.r-project.org/src/contrib/Archive/xfun/xfun_0.21.tar.gz' ...
Error: failed to retrieve package 'xfun'
In addition: Warning messages:
1: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
2: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
3: download failed [error code 35]
4: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
5: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
这是我的会话信息:
> 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_DOWNLOAD_METHOD = "curl")
(或 wininet
或libcurl
)我总是得到和以前一样的错误。
作为解决方法,我执行了以下操作:
- 关闭项目
- 正常安装包(没有 renv)
- 使用 renv 打开项目
- 恢复快照
如果这些包之前已经安装过,它们将被符号链接并且可以工作。
不幸的是,这非常麻烦,因为很多包都有依赖关系,我必须手动安装它们,这正是我想避免的事情之一,也是使用 renv 的原因之一!
为了文档:在遵循这个答案 https://github.com/rstudio/renv/issues/735#issuecomment-825778542 from Kevin Ushey 之后,我设法让它工作了:
- 将
renv
更新到最新版本(当前为 0.13.2)
- 运行
Sys.setenv(RENV_DOWNLOAD_METHOD = "wininet")
- 运行
renv::restore()
每当我想使用 renv:restore()
在我的 windows 机器上重新创建一个项目时,安装包总是失败。我总是得到同样的错误(尽管包可能会改变):
Retrieving 'https://cloud.r-project.org/src/contrib/Archive/xfun/xfun_0.21.tar.gz' ...
Error: failed to retrieve package 'xfun'
In addition: Warning messages:
1: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
2: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
3: download failed [error code 35]
4: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
5: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
这是我的会话信息:
> 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_DOWNLOAD_METHOD = "curl")
(或 wininet
或libcurl
)我总是得到和以前一样的错误。
作为解决方法,我执行了以下操作:
- 关闭项目
- 正常安装包(没有 renv)
- 使用 renv 打开项目
- 恢复快照
如果这些包之前已经安装过,它们将被符号链接并且可以工作。
不幸的是,这非常麻烦,因为很多包都有依赖关系,我必须手动安装它们,这正是我想避免的事情之一,也是使用 renv 的原因之一!
为了文档:在遵循这个答案 https://github.com/rstudio/renv/issues/735#issuecomment-825778542 from Kevin Ushey 之后,我设法让它工作了:
- 将
renv
更新到最新版本(当前为 0.13.2) - 运行
Sys.setenv(RENV_DOWNLOAD_METHOD = "wininet")
- 运行
renv::restore()