提问人:Max_BY 提问时间:11/8/2023 最后编辑:NimanthaMax_BY 更新时间:11/17/2023 访问量:54
如何修复RStudio中“terra”包的编译错误?
How to fix a compilation error of "terra" package in RStudio?
问:
R 包“terra”的安装尝试不断以持续编译错误告终(致命错误:无法打开文件“../tools/winlibs。R':没有这样的文件或目录)。
安慰
R version 4.0.1 (2020-06-06) -- "See Things Now"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> library(Rcpp)
> remotes::install_github("rspatial/terra")
Downloading GitHub repo rspatial/terra@HEAD
-- R CMD build ------------------------------------------------------------------------------------
v checking for file 'C:\Users\XXXXX\AppData\Local\Temp\Rtmp2tVCLq\remotes43fc7a481e9\rspatial-terra-9494a5e/DESCRIPTION' ...
- preparing 'terra': (3.1s)
v checking DESCRIPTION meta-information ...
- cleaning src
- checking for LF line-endings in source and make files and shell scripts (690ms)
- checking for empty or unneeded directories (372ms)
- building 'terra_1.7-59.tar.gz'
Warnung: file 'terra/cleanup' did not have execute permissions: corrected
Warnung: file 'terra/configure' did not have execute permissions: corrected
Installing package into ‘C:/Users/XXXXX/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'terra' ...
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
rm -f terra.dll RcppExports.o RcppFunctions.o RcppModule.o arith.o crs.o distRaster.o distance.o extract.o file_utils.o focal.o gcp.o gdal_algs.o gdal_multidimensional.o gdalio.o geodesic.o geos_methods.o geosphere.o math_utils.o mediancut.o memory.o movingWindow.o ncdf.o ram.o raster_methods.o raster_stats.o rasterize.o read.o read_gdal.o read_ogr.o sample.o sort.o spatBase.o spatDataframe.o spatFactor.o spatRaster.o spatRasterMultiple.o spatSources.o spatTime.o spatVector.o spatVector2.o string_utils.o vecmath.o vecmathse.o vector_methods.o write.o write_gdal.o write_ogr.o
mkdir -p ../inst
"C:/PROGRA~1/R/R-40~1.1/bin/x64/Rscript.exe" --vanilla "../tools/winlibs.R" 3.4.1
Fataler Fehler: kann Datei '../tools/winlibs.R' nicht öffnen: No such file or directory
make: *** [Makevars.win:27: winlibs] Error 2
ERROR: compilation failed for package 'terra'
* removing 'C:/Users/XXXXX/Documents/R/win-library/4.0/terra'
Warnmeldung:
In i.p(...) :
installation of package ‘C:/Users/XXXXX/AppData/Local/Temp/Rtmp2tVCLq/file43fc3a0e5fe4/terra_1.7-59.tar.gz’ had non-zero exit status
>
已经尝试重新安装 Rtools。
答:
0赞
Lara
11/9/2023
#1
我遇到了完全相同的问题,我通过安装最新版本的 R (R4.3.2) 然后再次尝试它解决了它,它起作用了。我还必须安装软件包“Rcpp”和 Rtools43。您可以在此处找到如何安装 Rtools43:https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html
install.packages("Rcpp")
然后我可以按照 GitHub (https://github.com/rspatial/terra) 上的建议安装软件包“terra”而不会出现任何问题。
Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")
remotes::install_github("rspatial/terra")
我在 Rgui 而不是 RStudio 中完成了所有这些工作,因为它在那里不起作用。
0赞
Robert Hijmans
11/12/2023
#2
安装“terra”发布版本的标准方法是
install.packages("terra")
开发版可以这样安装:
install.packages('terra', repos='https://rspatial.r-universe.dev')
使用起来比较复杂。而且您可能不需要它(您没有提供任何理由)。但是,如果您这样做,请参阅说明。install_github
评论
terra
sf
Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")
remotes::install_github("rspatial/terra")