0

R keeps getting stuck at this stage when I try to install the CRAN package terra using RStudio

Using Windows 10, R 4.0.4, RStuiod 1.4.1103

install.packages('terra')


* installing *source* package 'terra' ...
** package 'terra' successfully unpacked and MD5 sums checked
** using staged installation

   **********************************************
   WARNING: this package has a configure script
         It probably needs manual configuration
   **********************************************


** libs

*** arch - i386
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 graticule.o math_utils.o mediancut.o memory.o ncdf.o ram.o raster_methods.o raster_stats.o rasterize.o read.o read_gdal.o read_ogr.o sample.o spatBase.o spatDataframe.o spatRaster.o spatSources.o spatTime.o spatVector.o string_utils.o vecmath.o vector_methods.o write.o write_gdal.o write_ogr.o
mkdir -p ../inst
"C:/PROGRA~1/R/R-40~1.4/bin/i386/Rscript.exe" --vanilla "../tools/winlibs.R" 3.4.1

One thing that looks odd to me is the last line of output which seems to rever to an older version of R maybe 3.4.1? But I have 4.0.4 installed?

user69494
  • 1
  • 1

2 Answers2

1

I was also having issues trying to install terra in an older version of R. (Actually, I just wanted to rerun an older script that used the raster package but found terra was now a requirement.) I suspect the problem is that terra requires a library that no longer exists. Specifically, in https://rdrr.io/cran/terra/src/tools/winlibs.R, it asks to download a file at: "https://github.com/rwinlib/gdal3/archive/v%s.zip" where %s is VERSION. However, the archive directory no longer seems to exist. Unfortunately, I have not found a workaround for installing terra in older R versions.

SC_TX
  • 11
  • 1
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/34648844) – Paul Stafford Allen Jul 10 '23 at 08:13
0

install terra from dev branch, do not compile from src:

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

alternatively, first fulfill the prerequisites mentioned in the readme in the package repo on the GH: https://github.com/rspatial/terra

Tried locally on my win11 in both modes (dev & source). If Rcpp & Rtools are installed as author suggests, the package compiles properly.