Updated RStudio IDE, issues with package installation

I upgraded my Rstudio IDE, and created a new project for development and deployment of a QMD Shiny Dashboard. For this new project I also created a renv file.

Developing a Shiny QMD Dashboard requires installation of rmarkdown. In installing RMarkdown I receive the following error. I did try separately installing xfun, but it installs a different version (0.43 rather than 0.52) thus not resolving the error:

# Installing packages --------------------------------------------------------
- Installing xfun ...                           FAILED
Error: Error installing package 'xfun':
================================

* installing *source* package 'xfun' ...
** package 'xfun' successfully unpacked and MD5 sums checked
** using staged installation
** libs
Warning in system(paste(cmd, "shlib-clean")) : 'make' not found
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'xfun'
* removing 'C:/Users/Documents/RProjects/Project_Folder/renv/staging/1/xfun'
install of package 'xfun' failed [error code 1]

Session info:

> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

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

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1    renv_1.1.4   

This does not have much to do with RStudio, but it seems like you don't have RTools installed. You need RTools to install packages from source. Download RTools from here: RTools: Toolchains for building R and R packages from source on Windows

I would agree, but I was surprised that in the install packages interface in RStudio, RTools did not come up, is this expected?

image

Rtools is not an R package.

Thanks, I'd appreciate it if you could help me understand the underlying issue here.

When I have installed rmarkdown in other projects, I typically use the CRAN version, RTools not required.

Is there something with either my session, version of R, or the latest version of rmarkdown such that I would need to install RTools to install the package from the source at this juncture? I am not clear why the pre-compiled binary in CRAN of rmarkdown (and dependencies, in this case xfun) is creating an issue.

I am not sure why renv tries to install that version, probably because that's the version you have in the renv.lock file?

CRAN does not have pre-compiled binaries for all package versions and R versions, so unless you are using the latest version of R and the latest versions of packages, you probably need to compile them from source.

For xfun, CRAN actually has an xfun 0.43 binary, so it should install that, I am not sure why it is installing the source package:

options(pkg.platforms = c("x86_64-w64-mingw32", "source"))
options(pkg.r_versions = "4.2.1")
pak::meta_list("xfun")
# A data frame: 2 × 32
  package version depends      suggests license imports linkingto archs enhances
* <chr>   <chr>   <chr>        <chr>    <chr>   <chr>   <chr>     <chr> <chr>
1 xfun    0.43    NA           "testit… MIT + … grDevi… NA        x64   NA
2 xfun    0.52    R (>= 3.2.0) "testit… MIT + … grDevi… NA        NA    NA

In general, if you are using renv on Windows, you'll need to install Rtools. If you are pinning package versions, it is very unlikely that they'll keep being available as binary packages.