Problems installing packages using renv within a conda environment

I'm trying to use renv within a conda environment to keep track of my R packages without having to worry about creating my own conda packages. One of the packages I'd like to install is SRS, but when I run renv::install("SRS") it chokes on later. When I try to install later, I get the following output...

> renv::install("later")
Retrieving 'https://cloud.r-project.org/src/contrib/later_1.3.0.tar.gz' ...
        OK [file is up to date]
Installing later [1.3.0] ...
        FAILED
Error installing package 'later':
=================================

* installing *source* package ‘later’ ...
** package ‘later’ successfully unpacked and MD5 sums checked
** using staged installation
Running configure script
-latomic linker flag needed.
** libs
x86_64-conda-linux-gnu-c++ -std=gnu++11 -I"/home/me/miniconda3/envs/rare/lib/R/include" -DNDEBUG -pthread -DSTRICT_R_HEADERS  -I'/nfs/turbo/me-lab/me/project/renv/library/R-4.1/x86_64-conda-linux-gnu/Rcpp/include' -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/me/miniconda3/envs/rare/include -I/home/me/miniconda3/envs/rare/include -Wl,-rpath-link,/home/me/miniconda3/envs/rare/lib   -fpic  -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/me/miniconda3/envs/rare/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1648745733215/work=/usr/local/src/conda/r-base-4.1.3 -fdebug-prefix-map=/home/me/miniconda3/envs/rare=/usr/local/src/conda-prefix  -c RcppExports.cpp -o RcppExports.o
x86_64-conda-linux-gnu-c++: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
compilation terminated.
make: *** [/home/me/miniconda3/envs/rare/lib/R/etc/Makeconf:177: RcppExports.o] Error 1
ERROR: compilation failed for package ‘later’
* removing ‘/nfs/turbo/me-lab/me/project/renv/staging/1/later’
Error: install of package 'later' failed [error code 1]
Traceback (most recent calls last):
11: renv::install("later")
10: renv_install_impl(records)
 9: renv_install_staged(records)
 8: renv_install_default(records)
 7: handler(package, renv_install_package(record))
 6: renv_install_package(record)
 5: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
        vwritef("\tFAILED")
        writef(e$output)
    })
 4: renv_install_package_impl(record)
 3: r_cmd_install(package, path)
 2: r_exec_error(package, output, "install", status)
 1: stop(error)

Any ideas for me to try? I have gxx_linux-64 installed in the conda environment. At the moment all of my other packages install without an issue using renv::install(). If I am outside of conda, I can install the package without any issues using renv::install().

Here's my sessionInfo()...

> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/me/miniconda3/envs/rare/lib/libopenblasp-r0.3.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.3      BiocManager_1.30.16 tools_4.1.3        
[4] renv_0.15.4  

You are probably missing a system dependency (c++ compiler) which is needed to install that package. That dependency is correctly documented in Conda, so Conda-installing r-later should work and automatically install (among others) the required r-rcpp and gxx_linux-64.

If you really want to avoid installing all (or most) R packages via Conda, try to Conda-install gxx_linux-64 manually before running renv::install(...)
Source: cc1plus missing from conda env? · Issue #3080 · conda/conda-build · GitHub

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.