如何修复RStudio中“terra”包的编译错误?

sqougxex  于 2023-11-14  发布在  其他
关注(0)|答案(2)|浏览(312)

尝试安装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。
任何帮助都很感激。提前谢谢你!

c0vxltue

c0vxltue1#

我也遇到了同样的问题,我通过安装最新版本的R(R4.3.2)解决了这个问题,然后再次尝试,它工作了。我还必须安装软件包“Rcpp”和Rtools 43。你可以在这里找到如何安装Rtools 43:https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html

install.packages("Rcpp")

字符串
然后我可以安装包“terra”没有任何问题,建议在GitHub(https://github.com/rspatial/terra).

Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")
remotes::install_github("rspatial/terra")


我在Rgui中做了所有这些,而不是RStudio,因为它在那里不工作。我希望这能有所帮助!

3qpi33ja

3qpi33ja2#

安装已发布版本的“terra”的标准方法是

install.packages("terra")

字符串
开发版本可以这样安装:

install.packages('terra', repos='https://rspatial.r-universe.dev')


使用install_github更复杂。你可能不需要它(你没有提供任何理由)。但是如果你需要的话,请参阅instructions

相关问题