Search code examples
rfailed-installationrcpparmadillorenv

Error installing packages using renv::restore()


I have a problem using . For a larger project we want to use to all have the same version of and all our packages. Yet, as soon as a newer version of a package is available and we run renv::restore() we get an error like the following (please note: is not the only package. It also happens with greybox, mime, stringi and many more).

Error installing package 'RcppArmadillo':
=========================================

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

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


** libs
Warning in system(paste(cmd, "shlib-clean")) 'make' not found
Warning in system(cmd) 'make' not found
ERROR: compilation failed for package 'RcppArmadillo'
* removing 'C:/Users/..../renv/staging/1/RcppArmadillo'
Error: install of package 'RcppArmadillo' failed

I now have two questions:

  1. How can I fix this error?
  2. How can we use the same versions of packages throughout our team if crashes everytime a newer version is available?

Thank you. Lizzie


Solution

  • The ultimate issue here is that renv is trying to install these packages from sources, as binaries for these older packages are no longer available from CRAN. There are two potential solutions to this issue:

    1. Consider using a MRAN checkpoint as your R repository. The plus side is that binaries for these older packages will remain available; the downside is that you won't be informed if newer packages do become available.

    2. Install the requisite software so you can build these packages from sources.

    For 2. on Windows, you will need to install Rtools:

    https://cran.r-project.org/bin/windows/Rtools/

    You can also use the renv::equip() function to download a variety of libraries needed to compile some packages from sources (for example, nloptr).