Skip to content

R Lessons: document how to run update_cache() when there is a package conflict #40

@zkamvar

Description

@zkamvar

I recently ran into this fun thing, I am trying to make the release for the beta phase repositories and I was trying to build the R Raster lesson and ran into this fun error status when resolving the dependencies:

── managing R dependencies ──

ℹ Consent to use package cache provided
→ Searching for and installing available dependencies
Finding R package dependencies ... Done!
* Discovering package dependencies ... Done!
* Copying packages into the cache ... Done!
→ Restoring any dependency versions
The following package(s) will be updated:

# CRAN ===============================
- cli         [3.6.0 -> 3.5.0]
- evaluate    [0.20 -> 0.19]
- rmarkdown   [2.20 -> 2.19]
- tinytex     [0.44 -> 0.43]
- xfun        [0.37 -> 0.36]
- yaml        [2.3.7 -> 2.3.6]

# RSPM ===============================
- fs          [repo: CRAN -> RSPM; ver: 1.6.0 -> 1.5.2]
- knitr       [repo: CRAN -> RSPM; ver: 1.42 -> 1.41]
- sass        [repo: CRAN -> RSPM; ver: 0.4.5 -> 0.4.4]
- vctrs       [repo: CRAN -> RSPM; ver: 0.5.2 -> 0.5.1]
- renv        [* -> 0.16.0]

# https://carpentries.r-universe.dev =
- stringi     [repo: CRAN -> https://carpentries.r-universe.dev; ver: 1.7.12 -> 1.7.10; ref: * -> v1.7.10; sha: * -> 8558da46]

Installing cli [3.5.0] ...
	OK [linked cache]
Installing evaluate [0.19] ...
	OK [linked cache]
Installing fs [1.5.2] ...
	OK [linked cache]
Installing xfun [0.36] ...
	OK [linked cache]
Installing stringi [1.7.10] ...
	OK [linked cache]
Installing vctrs [0.5.1] ...
	OK [linked cache]
Installing yaml [2.3.6] ...
	OK [linked cache]
Installing knitr [1.41] ...
	OK [linked cache]
Installing sass [0.4.4] ...
	OK [linked cache]
Installing tinytex [0.43] ...
	OK [linked cache]
Installing rmarkdown [2.19] ...
	OK [linked cache]
Installing renv [0.16.0] ...
	OK [linked cache]
The following package(s) have been updated:

	cli  [installed version 3.5.0 != loaded version 3.6.0]
	yaml [installed version 2.3.6 != loaded version 2.3.7]

Consider restarting the R session and loading the newly-installed packages.

→ Recording changes in lockfile
The following package(s) have unsatisfied dependencies:

	tidyr requires vctrs (>= 0.5.2), but version 0.5.1 is installed
	dplyr requires vctrs (>= 0.5.2), but version 0.5.1 is installed

Consider updating the required dependencies as appropriate.

Error: 
! in callr subprocess.
Caused by error in `renv::snapshot(project = path, lockfile = renv_lock, prompt = FALSE)`:
! aborting snapshot due to pre-flight validation failure

Cause of the problem

The cause was due to an update in a package (dplyr and tidyr) requiring a new version of a dependency and, what I am assuming is, a race condition for updating the dependencies from the cache.

Solution

The solution is to update the cache before running the manage dependencies, which is achieved either through sandpaper::update_cache() or manually running the 03 Maintain: Update Cache workflow as shown here: carpentries/workbench-template-rmd#31

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions