Skip to content

install.packages(repos = X) from RStudio does not override the repos R option #13247

Open

Description

@daattali

There is a default R option for which repos to install from - getOption("repos").

When installing a package using install.packages(), you can provide a repos parameter. The default value of that parameter is getOption("repos"). This parameter should override the R option. In other words, if the parameter is provided, then the R option should be ignored. This is true when using R in the terminal, or when explicitly calling utils::install.packages(), but when calling simply install.packages() in RStudio, that's not the case.

options(repos=c(CRAN="https://badname.com/"))
install.packages("vctrs", repos = "https://cloud.r-project.org/")

The above code should go right into installation, but instead it first produces the warning below, and then installs.

Warning in install.packages :
  unable to access index for repository https://BADNAME.com/src/contrib:
  cannot open URL 'https://BADNAME.com/src/contrib/PACKAGES'

Activity

  1. added
    new
    on Jun 15, 2023
  2. kevinushey commented on Jun 15, 2023

    @kevinushey
    Collaborator

    This is likely happening here:

    if (!is.null(repos) && !packratMode && .rs.loadedPackageUpdates(pkgs)) {

    since that tries to check for package updates using the current repositories:

    avail <- available.packages()
    deps <- suppressMessages(suppressWarnings(
    utils:::getDependencies(pkgs, available=avail)))
    return(.rs.packagesLoaded(deps))

    Perhaps we should pass the repositories down to that call? Or only call it if repos wasn't explicitly provided?

  3. added and removed
    new
    on Jun 16, 2023
  4. github-actions commented on Dec 14, 2023

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

  5. added
    stale
    on Dec 14, 2023
  6. removed
    stale
    on Dec 14, 2023
  7. added this to the Product Backlog milestone on Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions