如果已安装的包可以从临时位置加载,则安装包测试时出现持续错误



当尝试像这样安装terra

Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")

remotes::install_github("rspatial/terra")

它开始编译包,在控制台中产生大量输出,但以错误(底部的错误)结束:

lhdf5 -lsz -lpng16 -lpng -lpoppler -llcms2 -lfreetype -lharfbuzz -lfreetype -llz4 -lpcre2-8 -lpcre -lcurl -lrtmp -lssl -lssh2 -lidn2 -lunistring -liconv -lgcrypt -lcrypto -lgpg-error -lws2_32 -ltiff -llzma -ljpeg -lz -lcfitsio -lzstd -lwebpdecoder -lwebp -lsbml-static -lgeotiff -lproj -lsqlite3 -lbz2 -lcrypt32 -lwldap32 -lsecur32 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~1/R/R-42~1.2/bin/x64 -lR
installing to C:/PackagesR/00LOCK-terra/00new/terra/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
in method for 'sds' with signature 'x="stars"': no definition for class "stars"
in method for 'sds' with signature 'x="stars_proxy"': no definition for class "stars_proxy"
in method for 'svc' with signature 'x="sf"': no definition for class "sf"
in method for 'coerce' with signature '"stars","SpatRasterDataset"': no definition for class "stars"
in method for 'coerce' with signature '"ggmap","SpatRaster"': no definition for class "ggmap"
in method for 'coerce' with signature '"sf","SpatRaster"': no definition for class "sf"
in method for 'coerce' with signature '"sf","SpatVector"': no definition for class "sf"
in method for 'coerce' with signature '"sfc","SpatVector"': no definition for class "sfc"
in method for 'coerce' with signature '"sfg","SpatVector"': no definition for class "sfg"
in method for 'coerce' with signature '"XY","SpatVector"': no definition for class "XY"
in method for 'coerce' with signature '"im","SpatRaster"': no definition for class "im"
in method for 'coerce' with signature '"SpatVector","Spatial"': no definition for class "Spatial"
in method for 'coerce' with signature '"Spatial","SpatVector"': no definition for class "Spatial"
in method for 'coerce' with signature '"SpatialGrid","SpatRaster"': no definition for class "SpatialGrid"
in method for 'coerce' with signature '"SpatialPixels","SpatRaster"': no definition for class "SpatialPixels"
in method for 'crs' with signature '"sf"': no definition for class "sf"
Creating a generic function for 'ncol' from package 'base' in package 'terra'
in method for 'distance' with signature 'x="SpatRaster",y="sf"': no definition for class "sf"
in method for 'ext' with signature 'x="sf"': no definition for class "sf"
in method for 'ext' with signature 'x="bbox"': no definition for class "bbox"
in method for 'ext' with signature 'x="Extent"': no definition for class "Extent"
in method for 'ext' with signature 'x="Raster"': no definition for class "Raster"
in method for 'ext' with signature 'x="Spatial"': no definition for class "Spatial"
in method for 'extract' with signature 'x="SpatRaster",y="sf"': no definition for class "sf"
in method for 'mask' with signature 'x="SpatRaster",mask="sf"': no definition for class "sf"
Creating a generic function for 'unserialize' from package 'base' in package 'terra'
Creating a generic function for 'readRDS' from package 'base' in package 'terra'
in method for 'lines' with signature 'x="leaflet"': no definition for class "leaflet"
in method for 'points' with signature 'x="leaflet"': no definition for class "leaflet"
in method for 'rast' with signature 'x="stars"': no definition for class "stars"
in method for 'rast' with signature 'x="stars_proxy"': no definition for class "stars_proxy"
in method for 'rasterize' with signature 'x="sf",y="SpatRaster"': no definition for class "sf"
in method for 'show' with signature '"Rcpp_SpatDataFrame"': no definition for class "Rcpp_SpatDataFrame"
in method for 'show' with signature '"Rcpp_SpatCategories"': no definition for class "Rcpp_SpatCategories"
in method for 'geomtype' with signature 'x="Spatial"': no definition for class "Spatial"
in method for 'vect' with signature 'x="Spatial"': no definition for class "Spatial"
in method for 'vect' with signature 'x="sf"': no definition for class "sf"
in method for 'vect' with signature 'x="sfc"': no definition for class "sfc"
in method for 'vect' with signature 'x="XY"': no definition for class "XY"
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
ERROR: loading failed
* removing 'C:/PackagesR/terra'
* restoring previous 'C:/PackagesR/terra'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/CORNVA~1/AppData/Local/Temp/Rtmp6Pz2Jn/file1eac467567ab/terra_1.6-44.tar.gz’ had non-zero exit status

不知道发生了什么。有人能提供一些如何解决这个问题的见解吗?

我有最新的Rtools, R和RStudio。我还安装了Rccp。

问候!

安装开发版的最简单方法在Windows上是

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

你得到的版本最多比github版本晚几个小时,但它已经编译好了。

要从github安装,您需要最新版本的RTools。从一个干净的会话开始也是非常重要的(没有加载包,参见sessionInfo();并确保在启动R会话时不加载先前的会话。

最新更新