英文:
Renv fails to compile packages but install.packages() works fine
问题
我遇到了以下问题:每当我想通过renv特定的命令安装包“class”时,例如renv::restore()或renv::install("class@7.3-20"),我会收到错误消息。但是,如果我运行install.packages("class",version="7.3-20"),一切都正常。
我从renv诊断开始:
> renv::diagnostics()
诊断报告 [renv 0.17.3]
================================
# 会话信息 =======================
R版本4.3.0(2023-04-21 ucrt)
平台:x86_64-w64-mingw32/x64(64位)
运行环境:Windows 10 x64(版本19045)
矩阵产品:默认
使用renv安装“class”会得到以下消息
> renv::install("class@7.3-20")
考虑从您的R库中删除这些文件夹。
检索'https://cran.rstudio.com/src/contrib/Archive/class/class_7.3-20.tar.gz'...
已完成 [文件已经是最新的]
安装class [7.3-20]...
失败
安装包'class'时出错:
=================================
* 正在安装*源*包'class'...
** 安装包'class'成功解包并验证MD5摘要
** 使用分阶段的安装
** libs
使用C编译器:'gcc.exe (GCC) 12.2.0'
gcc -I"C:/PROGRA~1/R/R-43~1.0/include" -DNDEBUG -I"C:\Users\mschleri\AppData\Local/R/cache/R/renv/extsoft/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c class.c -o class.o
class.c:31:9: 错误:未知类型名称'Sint';您是否想要'int'?
31 | VR_knn1(Sint *pntr, Sint *pnte, Sint *p, double *train, Sint *class,
| ^~~~
| int
.
.
.
make:*** [C:/PROGRA~1/R/R-43~1.0/etc/x64/Makeconf:265: class.o] 错误1
ERROR:包'class'的编译失败
另一方面,使用install.packages("class", version="7.3-20")可以正常工作。Rtools已安装并且在renv包之外正常工作。是否可能是renv不支持当前的Rtools版本(43)?他们仍然在GitHub上有一个未解决的问题,以修复对rtools 43的支持(https://github.com/rstudio/renv/issues/1214)。
感谢任何建议和帮助!
英文:
I run into the following problem: everytime I would like to install the package "class" through renv specific commands, e.g. renv::restore() or renv::install("class@7.3-20"), I get an error message. However, if I run install.packages("class",version="7.3-20") everything works fine.
I start with the renv diagnostics:
> renv::diagnostics()
Diagnostics Report [renv 0.17.3]
================================
# Session Info =======================
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
Installing "class" with renv gives the following message
> renv::install("class@7.3-20")
Consider removing these folders from your R library.
Retrieving 'https://cran.rstudio.com/src/contrib/Archive/class/class_7.3-20.tar.gz' ...
OK
Installing class [7.3-20] ...
FAILED
Error installing package 'class':
=================================
* installing *source* package 'class' ...
** Paket 'class' erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
using C compiler: 'gcc.exe (GCC) 12.2.0'
gcc -I"C:/PROGRA~1/R/R-43~1.0/include" -DNDEBUG -I"C:\Users\mschleri\AppData\Local/R/cache/R/renv/extsoft/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c class.c -o class.o
class.c:31:9: error: unknown type name 'Sint'; did you mean 'int'?
31 | VR_knn1(Sint *pntr, Sint *pnte, Sint *p, double *train, Sint *class,
| ^~~~
| int
.
.
.
make: *** [C:/PROGRA~1/R/R-43~1.0/etc/x64/Makeconf:265: class.o] Error 1
ERROR: compilation failed for package 'class'
Installing class install.packages("class",version="7.3-20") on the other hands works without problems. Rtools is installed and works fine outside of the renv package. Could it be that renv does not support the current Rtools version (43)? They still have an open issue on github to fix the support of rtools 43 (https://github.com/rstudio/renv/issues/1214).
Thanks for any suggestions and help!
答案1
得分: 7
这与Rtools无关,而与您尝试做的事情有关。
install.packages()
函数会忽略您的version
参数,因此您将获得最新版本,即7.3-22。版本7.3-20与R 4.3.x不兼容,因为Sint
和相关定义已被删除。
因此,如果您想安装7.3-20,您需要使用较旧版本的R。
英文:
This doesn't have anything to do with Rtools, it's an issue with what you are trying to do.
The install.packages()
function will ignore your version
argument, so you'll get the latest version, 7.3-22. Version 7.3-20 is not compatible with R 4.3.x, because the Sint
and related definitions have been dropped.
So if you want to install 7.3-20, you'll need to use an older version of R.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论