Bikem Ekberzade
Bikem Ekberzade

Reputation: 15

Issues with installing "terra" package in R Studio on Windows 11

I'm using R Studio Version:

RStudio 2022.02.3+492 "Prairie Trillium" Release (1db809b8323ba0a87c148d16eb84efe39a8e7785, 2022-05-20) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

on Windows 11, with Rtools42 (rtools42-5355-5357) installed (as specified by the package developer). I also have terra's dependency Rcpp installed without problems. However I cannot get terra to install properly, I keep on getting this message:

> install.packages("terra", lib="C:/Program Files/R/R-3.6.3/library")

There is a binary version available but the source version is later: binary source needs_compilation terra 1.2-5 1.7-39 TRUE

installing the source package ‘terra’

trying URL 'https://cran.rstudio.com/src/contrib/terra_1.7-39.tar.gz' Content type 'application/x-gzip' length 815403 bytes (796 KB) downloaded 796 KB

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 Error in .shlib_internal(args) : C++17 standard requested but CXX17 is not defined removing 'C:/Program Files/R/R-3.6.3/library/terra' restoring previous 'C:/Program Files/R/R-3.6.3/library/terra' Warning in install.packages : installation of package ‘terra’ had non-zero exit status

The downloaded source packages are in ‘C:\Users\ITU\AppData\Local\Temp\RtmpMXWK42\downloaded_packages’

When I try to install the package as specified on the GitHub page of the developer using:

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

I get this similar response:

Downloading GitHub repo rspatial/terra@HEAD checking for file 'C:\Users\ITU\AppData\Local\Temp\RtmpMXWK42\remotesa9e45faa574b\rspatial-terra-78ae185/DESCRIPTION' ... preparing 'terra': (465ms) checking DESCRIPTION meta-information ... cleaning src checking for LF line-endings in source and make files and shell scripts (1.2s) checking for empty or unneeded directories building 'terra_1.7-42.tar.gz' Warning: file 'terra/cleanup' did not have execute permissions: corrected Warning: file 'terra/configure' did not have execute permissions: corrected

Installing package into ‘D:/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) installing source package 'terra' ... using staged installation


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


libs

arch - i386 Error in .shlib_internal(args) : C++17 standard requested but CXX17 is not defined removing 'D:/Documents/R/win-library/3.6/terra' Warning message: In i.p(...) : installation of package ‘C:/Users/ITU/AppData/Local/Temp/RtmpMXWK42/filea9e42194bbd/terra_1.7-42.tar.gz’ had non-zero exit status

Has anyone else had the similar problem recently and managed to solve it?

I tried also tried re: and older StackOverflow suggestion:

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

to see if it would work, but I get the same compiler compatibility error:

Installing package into ‘D:/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘terra’ installing the source package ‘terra’

trying URL 'https://rspatial.r-universe.dev/src/contrib/terra_1.7-42.tar.gz' Content type 'application/x-gzip' length 1794771 bytes (1.7 MB) downloaded 1.7 MB

  • installing source package 'terra' ... ** using staged installation

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

** libs

*** arch - i386 Error in .shlib_internal(args) : C++17 standard requested but CXX17 is not defined

  • removing 'D:/Documents/R/win-library/3.6/terra' Warning in install.packages : installation of package ‘terra’ had non-zero exit status

Upvotes: 1

Views: 575

Answers (1)

Roland
Roland

Reputation: 132969

The RStudio version is almost completely irrelevant. You need to update R to the newest version and you need to install Rtools43 (or later versions in the future).

Upvotes: 1

Related Questions