For us, there is no spring. Just the wind that smells fresh before the storm

conan provides a light wrapper around pkgdepends in order to create standalone libraries. Our use case is creating libraries for use with HPC systems. It is not as broad or designed for interactive use like renv, packrat or pak. Instead it tries to address the narrow problem of “how do you install packages from diverse sources without necessarily already having your package installer present?”.

To solve this problem, create a standalone script that can install its own dependencies and then install a required set of packages:


That will create a file like:

#!/usr/bin/env Rscript
`%||%` <- function (x, y)
    if (is.null(x))
    else x
[... skip ...]
.dat <- parse_main_conan(name = "script")
.packages <- c("cpp11", "mrc-ide/dust", "mrc-ide/mcstate@some-feature")
.repos <- c(CRAN = "")
.policy <- "upgrade"
.lib <- .dat$lib
conan_install(.lib, .packages, policy = .policy, repos = .repos)

Then this script can be run from the command line:

./script lib

(or on Windows Rscript script lib), which will create a library at path lib

Dependency resolution

All the dependency resolution is done by pkgdepends. Use of the Remotes field in DESCRIPTION can create impossible installation situations, beware. In particular, if a package is installed from a CRAN-like repo and also via a Remotes: field in a package you are installing via a remotes-style reference, then you will get a “conflict” from pkgdepends.


To install conan:

remotes::install_github("mrc-ide/conan", upgrade = FALSE)


MIT © Imperial College of Science, Technology and Medicine