Skip to content

renv installing packages out of order #2273

@noamross

Description

@noamross

renv (v1.2.1) appears to be installing packages out of order after downloading, resulting in package failures due to dependency issues. For example:

> renv::install('bridgesampling')
The following package(s) will be installed:
- bridgesampling [1.2-1]
- mvtnorm        [1.3-6]
These packages will be installed into "/sfs/gpfs/tardis/home/tbv4up/R/goolf/4.5".

Do you want to proceed? [Y/n]: 
y

# Downloading packages -------------------------------------------------------
✔ mvtnorm 1.3-6                            [1.0 MB in 0.17s]                                                                                                 
✔ bridgesampling 1.2-1                     [1.3 MB in 0.17s]                                                                                                 
Successfully downloaded 2 packages in 0.72 seconds.                                                                                                          

# Installing packages --------------------------------------------------------
✔ bridgesampling 1.2-1                     [installed binary]
Traceback (most recent calls last):
13: renv::install('bridgesampling') at #1
12: renv_graph_install(descriptions)
11: renv_graph_install_finalize(entry$record, prepared, installdir, 
        project, linkable)
10: tryCatch(renv_install_test(package), error = function(err) {
        unlink(installpath, recursive = TRUE)
        stop(err)
    })
 9: tryCatchList(expr, classes, parentenv, handlers)
 8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 7: value[[3L]](cond)
 6: stop(err)
 5: <condition-handler>(...)
 4: <condition-handler>(...)
 3: invoke_option_error_handler() at <text>#32
 2:         withCallingHandlers(
                {
                    # Evaluate from a promise to keep a simple call stack.
                    # We do evaluate from a closure wrapped in `handler()` so that R
                    # can infer a named call, for instance in the "Called from:"
                    # output of `browser()`.
                    error_handler <- eval(bquote(function() .(hnd)))
                    error_handler()
                },
                error = function(err) {
                    # Disable error handler to avoid cascading errors
                    options(error = NULL)
    
                    # We don't let the error propagate to avoid a confusing sequence of
                    # error messages from R, such as "Error during wrapup"
                    writeLines(
                        c(
                            "The `getOption(\"error\")` handler failed.",
                            "This option was unset to avoid cascading errors.",
                            "Caused by:",
                            conditionMessage(err)
                        ),
                        con = stderr()
                    )
    
                    # Bail early
                    non_local_return
                }
            ) at <text>#221
 1: error_handler() at <text>#228

Error:
! error testing if 'bridgesampling' can be loaded [error code 1]
/sfs/gpfs/tardis/applications/202512/software/standard/mpi/gcc/11.4.0/openmpi/4.1.4/R/4.5.0/lib64/R/bin/R --vanilla -s -f '/tmp/Rtmp1CAnKI/renv-install-98e8f3e659422.R'
================================================================================

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘mvtnorm’
Calls: loadNamespace ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted

I have the following options set:

options(
    repos = c(
        CRAN = "https://packagemanager.posit.co/cran/__linux__/centos8/latest",
        CRANHaven = "https://cranhaven.r-universe.dev"
    ),
    renv.config.install.verbose = TRUE,
    renv.config.cache.symlinks = TRUE,
    renv.config.cache.enabled = TRUE,
    renv.config.install.jobs = 6,
    pkgType = "binary",
    Ncpus = 6
)
> sessionInfo()
R version 4.5.0 (2025-04-11)
Platform: x86_64-pc-linux-gnu
Running under: Rocky Linux 8.10 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /sfs/gpfs/tardis/applications/202512/software/standard/compiler/gcc/11.4.0/openblas/0.3.21/lib/libopenblas_sandybridgep-r0.3.21.so;  LAPACK version 3.9.0

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

time zone: America/New_York
tzcode source: system (glibc)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions