Skip to content

R: Switch R installation task to use pak #1631

Closed

Description

@juliasilge

We do think that the default behaviour of devtools::install(upgrade = "always") is a problem. For package devs, this frequently leads to attempts to upgrade and install direct/indirect dependencies, from source, from GitHub. It feels like devtools::install() can end up doing too much and more than it was really asked to to, in this use case. Even if you don't mind the upgrades, it exposes the whole task to more reasons to fail, which are arguably unrelated to the job it was asked to do.

We could instead execute devtools::install(upgrade = "never") or devtools::install(upgrade = FALSE). Or we also like the idea of shifting to pak::local_install(upgrade = FALSE), because here upgrade = FALSE aligns much better with what we want:

When FALSE, the default, pak does the minimum amount of work to give you the latest version(s) of pkg. It will only upgrade dependent packages if pkg, or one of their dependencies explicitly require a higher version than what you currently have. It will also prefer a binary package over to source package, even it the binary package is older.

Originally posted by @jennybc in #1279 (comment)

As we start to use more R packages, we will need to think about a check_installed() type of experience as outlined in #1629.

Activity

  1. self-assigned this
    on Dec 21, 2023
  2. jennybc commented on Jan 17, 2024

    @jennybc
    Member

    Verified with

    Positron Version: 2024.01.0 (Universal) build 162
    Code - OSS Version: 1.85.0
    Commit: aeb47f532448b4f691fe7432f8b6938bcb565d34
    Date: 2024-01-17T17:34:28.863Z
    Electron: 25.9.7
    ElectronBuildId: undefined
    Chromium: 114.0.5735.289
    Node.js: 18.15.0
    V8: 11.4.183.29-electron.0
    OS: Darwin arm64 22.6.0
    

    We see this in the terminal:

    Executing task: "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R" -e "pak::local_install(upgrade = FALSE)" 
    
    
    R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
    Copyright (C) 2023 The R Foundation for Statistical Computing
    Platform: aarch64-apple-darwin20 (64-bit)
    
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.
    
      Natural language support but running in an English locale
    
    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.
    
    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.
    
    > pak::local_install(upgrade = FALSE)
    ✔ Updated metadata database: 7.95 MB in 10 files.
    ℹ R 4.3 aarch64-apple-darwin20 packages are missing from Bioconductor
    ✔ Updating metadata database ... done
     
    → Will update 2 packages.
    → Will download 1 CRAN package (24.80 kB), cached: 1 (0 B).
    + askpass 1.2.0      → 1.2.0      🔧 ⬇ (24.80 kB)
    + usethis 2.2.2.9000 → 2.2.2.9000 👷🏾‍♀️
    ℹ Getting 1 pkg (24.80 kB), 1 cached
    ✔ Got usethis 2.2.2.9000 (source) (96 B)
    ✔ Cached copy of askpass 1.2.0 (aarch64-apple-darwin20) is the latest build
    ✔ Installed askpass 1.2.0  (25ms)
    ℹ Packaging usethis 2.2.2.9000
    ✔ Packaged usethis 2.2.2.9000 (2.4s)
    ℹ Building usethis 2.2.2.9000
    ✔ Built usethis 2.2.2.9000 (2.3s)
    ✔ Installed usethis 2.2.2.9000 (local) (49ms)
    ✔ 1 pkg + 30 deps: kept 27, upd 2, dld 1 (NA B) [21.7s]
    > 
    > 
     *  Terminal will be reused by tasks, press any key to close it. 
    

    And, as usual, R is restarted in the Console and library(usethis) is immediately executed.

  3. locked as resolved and limited conversation to collaborators on Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions