RcppAnnoy won't install in a renv (MacOS)
Hi,
After struggling far too long with trying to set up an app that's hosted on a Git repo and developped by colleagues, I've narrowed my issue down to some interaction between `renv` and RcppAnnoy: I can't install RcppAnnoy in a fresh R session that is managed by a `renv`, with a very cryptic (to me) error message.
Reprex :
1) Start afresh: from Rstudio, initialize a new project New Directory -> New project -> Whatever name and location, remember to *check* "Use renv with this project"
2) renv::install("RcppAnnoy")
Output:
```
R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin25.0.0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
- Project '~/Documents/Open Desks/renvtest' loaded. [renv 1.1.5]
> renv::install("RcppAnnoy")
# Downloading packages -------------------------------------------------------
- Downloading RcppAnnoy from CRAN ... OK [153.9 Kb in 1.1s]
Successfully downloaded 1 package in 1.8 seconds.
The following package(s) will be installed:
- RcppAnnoy [0.0.22]
These packages will be installed into "~/Documents/Open Desks/renvtest/renv/library/macos/R-4.5/aarch64-apple-darwin25.0.0".
Do you want to proceed? [Y/n]: Y
# Installing packages --------------------------------------------------------
- Installing RcppAnnoy ... FAILED
Error: Error installing package 'RcppAnnoy':
=====================================
* installing *source* package ‘RcppAnnoy’ ...
** this is package ‘RcppAnnoy’ version ‘0.0.22’
** package ‘RcppAnnoy’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc-15 (Homebrew GCC 15.2.0) 15.2.0’
using C++ compiler: ‘g++-15 (Homebrew GCC 15.2.0) 15.2.0’
using C++17
using SDK: ‘MacOSX26.1.sdk’
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.5.2_1/lib/R/include" -DNDEBUG -I../inst/include/ -I'/Users/tobadia/Documents/Open Desks/renvtest/renv/library/macos/R-4.5/aarch64-apple-darwin25.0.0/Rcpp/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.5.2_1/lib/R/include" -DNDEBUG -I../inst/include/ -I'/Users/tobadia/Documents/Open Desks/renvtest/renv/library/macos/R-4.5/aarch64-apple-darwin25.0.0/Rcpp/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c annoy.cpp -o annoy.o
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.5.2_1/lib/R/include" -DNDEBUG -I../inst/include/ -I'/Users/tobadia/Documents/Open Desks/renvtest/renv/library/macos/R-4.5/aarch64-apple-darwin25.0.0/Rcpp/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c arch.cpp -o arch.o
gcc-15 -I"/opt/homebrew/Cellar/r/4.5.2_1/lib/R/include" -DNDEBUG -I../inst/include/ -I'/Users/tobadia/Documents/Open Desks/renvtest/renv/library/macos/R-4.5/aarch64-apple-darwin25.0.0/Rcpp/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c init.c -o init.o
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.5.2_1/lib/R/include" -DNDEBUG -I../inst/include/ -I'/Users/tobadia/Documents/Open Desks/renvtest/renv/library/macos/R-4.5/aarch64-apple-darwin25.0.0/Rcpp/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c version.cpp -o version.o
clang++ -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/opt/homebrew/Cellar/r/4.5.2_1/lib/R/lib -L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/xz/lib -L/opt/homebrew/lib -o RcppAnnoy.so RcppExports.o annoy.o arch.o init.o version.o -L/opt/homebrew/Cellar/r/4.5.2_1/lib/R/lib -lR
installing to /Users/tobadia/Documents/Open Desks/renvtest/renv/staging/1/00LOCK-RcppAnnoy/00new/RcppAnnoy/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RcppAnnoy’ in .doLoadActions(where, attach):
error in load action .__A__.1 for package RcppAnnoy: loadModule(module = "AnnoyAngular", what = TRUE, env = ns, loadNow = TRUE): Unable to load module "AnnoyAngular": vector memory limit of 48.0 Gb reached, see mem.maxVSize()
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/tobadia/Documents/Open Desks/renvtest/renv/staging/1/RcppAnnoy’
install of package 'RcppAnnoy' failed [error code 1]
```
Some notes:
- Without an renv-managed environment, all seems to work
- My R install is managed by Homebrew
- I have GCC installed from Homebrew, and C & CXX set in my .Makevars, but commenting these out does not change anything (+ it just works in any other setting)
```
tobadia@ML24-0166:~/Documents/Open Desks/renvtest % cat ~/.R/Makevars
CC=gcc-15
CXX=g++-15
```
- Output of sessionInfo()
```
> sessionInfo()
R version 4.5.2 (2025-10-31)
Platform: aarch64-apple-darwin25.0.0
Running under: macOS Tahoe 26.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /opt/homebrew/Cellar/r/4.5.2_1/lib/R/lib/libRlapack.dylib; LAPACK version 3.12.1
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: Europe/Paris
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] compiler_4.5.2 tools_4.5.2 renv_1.1.5
```
I have absolutely *no idea* as to hwo to troubleshoot this. Any suggestion would be welcome and I hope this issue won't be bothering too much!
Best
Thomas
0 条评论