lwgeom install in normal R session, but not with renv::install() inside a project
nuvanrath opened this issue · comments
Hi, I'm running R 4.3.1 on an arm-64 mac, and I've got a peculiar problem. If I open up RStudio in a fresh session and run install.packages("lwgeom")
, it successfully installs the package. However, if I open up an RStudio project where I am trying to use renv
for package control, and run renv::install("lwgeom")
I get the following error output:
# Installing packages -----------------------------------------------------
- Installing lwgeom ... FAILED
Error: Error installing package 'lwgeom':
==================================
* installing *source* package ‘lwgeom’ ...
** package ‘lwgeom’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: clang -arch arm64
configure: CXX: clang++ -arch arm64 -std=gnu++17
./configure: line 2264: pkg-config: command not found
checking for gcc... clang -arch arm64
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether clang -arch arm64 accepts -g... yes
checking for clang -arch arm64 option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for proj.h... no
checking for pj_init_plus in -lproj... no
configure: error: libproj not found in standard or given locations.
ERROR: configuration failed for package ‘lwgeom’
* removing ‘/Users/nrath/Documents/cafo/renv/staging/1/lwgeom’
install of package 'lwgeom' failed [error code 1]
My sessionInfo is:
> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] compiler_4.3.1 tools_4.3.1 rstudioapi_0.15.0 renv_1.0.5
Any thoughts on how I can correct this?
It seems that renv
is not good at installing R packages with system requirements; see also r-spatial/sf#2360 r-spatial/sf#2353 r-spatial/sf#2353 r-spatial/sf#2244
See also rstudio/renv#1860
Ah, thank you. So for version pinning in a project using sf
, would the recommendation be to use Docker rather than renv
?
Definitely if you install packages from source; if you install binary packages from CRAN on MacOS or Windows this may not be needed (all system requirements are statically linked in the R package directory).
./configure: line 2264: pkg-config: command not found
Most likely, the PATH in your R session in your renv
project differs in some way from the "default" PATH, but it's not clear why that would be the case.
It seems that
renv
is not good at installing R packages with system requirements; see also r-spatial/sf#2360 r-spatial/sf#2353 r-spatial/sf#2353 r-spatial/sf#2244
It seems everybody is just pushing the problem away.
See related renv
reply: rstudio/renv#1860 (comment)