Difficulty Installing fasterRaster
Hi Adam,
I just updated my R version to 4.3.3 due to issues with another package (the terra::extract function has been throwing weird errors for me for weeks now). It looked like I had resolved that, but in the process of trying to reinstall the fasterRaster package, I've been getting errors:
When installing normally: ` remotes::install_github('adamlilith/fasterRaster', dependencies = TRUE) Downloading GitHub repo adamlilith/fasterRaster@HEAD Skipping 1 packages ahead of CRAN: terra ── R CMD build ─────────────────────────────────────────────────────────────────────────────────── ✔ checking for file 'C:\Users\katie\AppData\Local\Temp\RtmpCaAsKe\remotes65f441094753\adamlilith-fasterRaster-fb3d235/DESCRIPTION' ... ─ preparing 'fasterRaster': (2.3s) ✔ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts (451ms) ─ checking for empty or unneeded directories ─ building 'fasterRaster_8.3.0.7003.tar.gz'
Installing package into ‘C:/Users/katie/AppData/Local/R/win-library/4.3’ (as ‘lib’ is unspecified)
- installing source package 'fasterRaster' ... ** using staged installation ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading Creating a generic function for '%in%' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for '%notin%' in package 'fasterRaster' Creating a generic function for 'barplot' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'cor' in package 'fasterRaster' Creating a new generic function for 'cov' in package 'fasterRaster' Creating a generic function for 'droplevels' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'grid' in package 'fasterRaster' Creating a generic function for 'hist' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'intersect' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'kernel' in package 'fasterRaster' Creating a generic function for 'match' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'merge' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'nlevels' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'pairs' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'plot' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'predict' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'quantile' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'scale' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'show' from 'methods' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'update' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'union' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'xor' in package 'fasterRaster' Creating a generic function for 'sd' from package 'stats' in package 'fasterRaster' Creating a generic function for 'var' from package 'stats' in package 'fasterRaster' Error : in method for 'activeCat<-' with signature 'x="GRaster",value="numeric"': arguments ('value') after '...' in the generic must appear in the method, in the same place at the end of the argument list Error: unable to load R code in package 'fasterRaster' Execution halted ERROR: lazy loading failed for package 'fasterRaster'
- removing 'C:/Users/katie/AppData/Local/R/win-library/4.3/fasterRaster' Warning message: In i.p(...) : installation of package ‘C:/Users/katie/AppData/Local/Temp/RtmpCaAsKe/file65f47e3354d1/fasterRaster_8.3.0.7003.tar.gz’ had non-zero exit status`
When installing the development version: `remotes::install_github('adamlilith/fasterRaster@intuitive_fasterRaster', dependencies = TRUE) Downloading GitHub repo adamlilith/fasterRaster@intuitive_fasterRaster Skipping 1 packages ahead of CRAN: terra ── R CMD build ─────────────────────────────────────────────────────────────────────────────────── ✔ checking for file 'C:\Users\katie\AppData\Local\Temp\RtmpCaAsKe\remotes65f42cd552eb\adamlilith-fasterRaster-9eb0c98/DESCRIPTION' ... ─ preparing 'fasterRaster': (2s) ✔ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts (441ms) ─ checking for empty or unneeded directories ─ building 'fasterRaster_8.3.0.7004.tar.gz'
Installing package into ‘C:/Users/katie/AppData/Local/R/win-library/4.3’ (as ‘lib’ is unspecified)
- installing source package 'fasterRaster' ... ** using staged installation ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading Creating a generic function for '%in%' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for '%notin%' in package 'fasterRaster' Creating a generic function for 'barplot' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'cor' in package 'fasterRaster' Creating a new generic function for 'cov' in package 'fasterRaster' Creating a generic function for 'droplevels' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'grid' in package 'fasterRaster' Creating a generic function for 'hist' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'intersect' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'kernel' in package 'fasterRaster' Creating a generic function for 'match' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'merge' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'nlevels' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'pairs' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'plot' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'predict' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'quantile' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'scale' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'show' from 'methods' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'update' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a generic function for 'union' from 'terra' in package 'fasterRaster' (from the saved implicit definition) Creating a new generic function for 'xor' in package 'fasterRaster' Creating a generic function for 'sd' from package 'stats' in package 'fasterRaster' Creating a generic function for 'var' from package 'stats' in package 'fasterRaster' Error : in method for 'activeCat<-' with signature 'x="GRaster",value="numeric"': arguments ('value') after '...' in the generic must appear in the method, in the same place at the end of the argument list Error: unable to load R code in package 'fasterRaster' Execution halted ERROR: lazy loading failed for package 'fasterRaster'
- removing 'C:/Users/katie/AppData/Local/R/win-library/4.3/fasterRaster' Warning message: In i.p(...) : installation of package ‘C:/Users/katie/AppData/Local/Temp/RtmpCaAsKe/file65f468d87d73/fasterRaster_8.3.0.7004.tar.gz’ had non-zero exit status`
Hi K (I won't use your full name)! Thanks for letting me know. I just pushed a version, 8.3.0.7004, that does not have the issue you found (at least on my machine--I've tested locally and installing from GitHub). So, your install method should work now. However, this new version depends on a new version of the omnibus package that isn't yet on CRAN (it should be in a few days). So in the meantime, you will need to manually install the new version of that package.
You can do this as: `remotes::install_github('adamlilith/omnibus')
Alternatively, I've added a folder named /tar to the fasterRaster repository with the tar files for this latest version of fasterRaster and omnibus. You can then install them using the R or RStudio interface. This way, you can archive these versions if you'd like.
It looks like installing omnibus worked without an issue - should I install fasterRaster using
'remotes::install_github('adamlilith/fasterRaster', dependencies = TRUE)'
or
'remotes::install_github('adamlilith/fasterRaster@intuitive_fasterRaster', dependencies = TRUE)'
?
Right now, you can do either (they are the same versions), but I’d suggest in the future, installing from the main branch (your first option). Please let me know if anything remains amiss!
From: K. E. C. Davis @.> Sent: Wednesday, April 3, 2024 1:30 PM To: adamlilith/fasterRaster @.> Cc: Adam Smith @.>; Comment @.> Subject: Re: [adamlilith/fasterRaster] Difficulty Installing fasterRaster (Issue #69)
It looks like installing omnibus worked without an issue - should I install fasterRaster using
'remotes::install_github('adamlilith/fasterRaster', dependencies = TRUE)'
or
@.***_fasterRaster', dependencies = TRUE)'
?
— Reply to this email directly, view it on GitHubhttps://github.com/adamlilith/fasterRaster/issues/69#issuecomment-2035310545, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABZZ3ZU4WAMYE6S7Y34UDYLY3RDBVAVCNFSM6AAAAABFVOWUOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZVGMYTANJUGU. You are receiving this because you commented.Message ID: @.@.>>
Hmmm, I did try both (starting with the main branch) but I'm still getting what looks like the same error message as I was getting initially.
And installing from the tar file just threw the same message!
Are there any dependencies I should check that I have/have the right version of besides omnibus?
Hi K,
Well, shoot... this is hard for me to fix since I can't recreate it on my systems. However, I know in the end you want TWI, regardless of how you get it. So, in the meantime, here's a script that uses rgrass to call the appropriate GRASS modules (below).
Could you please help me find the issue you're encountering? Could you please start R fresh, try to do the install so it fails (any way is OK), then paste here the output from sessionInfo()?
Thank you!
# Topographic Wetness Index
library(terra)
library(rgrass)
elev <- rast('E:/!Scratch/madElev.tif') # NB raster must be projected (not WGS84, etc.)
# initiate GRASS session: connect to GRASS and setup location/mapset
initGRASS(
gisBase = 'C:/Program Files/GRASS GIS 8.3', # install location of GRASS for your system
home = tempdir(),
SG = elev,
location = 'anyNameWillDo', # any string--no spaces or other weird characters
mapset = 'PERMANENT',
override = TRUE, # must be TRUE to restart, even in different location/mapset
remove_GISRC = TRUE, # remove previous GRASS sessions
ignore.stderr = TRUE
)
# import raster
write_RAST(elev, vname = 'elevation')
# set GRASS "region" dimensions (affects the extent/resolution of the output)
execGRASS('g.region', raster = 'elevation', align = 'elevation')
# TPI
execGRASS('r.topidx', input = 'elevation', output = 'twi')
# move TWI raster from GRASS to R (make a SpatRaster)
twi <- read_RAST('twi')
plot(twi)
# does TWI raster align with the elevation raster?
c(twi, elev) # yes... if it did not, this would throw an error
I seem to be having lots of "I can't recreate this issue" problems lately! That's part of why I had reinstalled and updated R.
I hit the same error message, so here's the sessionInfo():
sessionInfo()
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/Buenos_Aires
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] processx_3.8.4 compiler_4.3.3 R6_2.5.1 cli_3.6.2 tools_4.3.3 rstudioapi_0.16.0
[7] curl_5.2.1 remotes_2.5.0 Rcpp_1.0.12 codetools_0.2-19 desc_1.4.3 callr_3.7.6
[13] ps_1.7.6 pkgbuild_1.4.4 terra_1.7-74
Thank you for the session info! Did the rgrass script work for you?
Yes! It took me a little while to work out some kinks (even though my data was projected, it kept telling me it wasn't) - but I finally got it sorted! I appreciate the work-around!
Oh, good! I’ll dig in and see if I can reproduce that error. Thank you for letting me know and your assistance with it.
This should be solved now, as it was related to/the same as issue https://github.com/adamlilith/fasterRaster/issues/75.
fasterRaster verision 8.3.0.7009 (still on branch intuitive_fasterRaster, not master, as of today.