Renv looks at bioconductor URLs when installing CRAN packages

I am using renv to manage R packages in a project. The project uses packages both from bioconductor and CRAN. When I update/install packages from a lock file with "renv::restore()", I receive the following error message:

For certain CRAN packages, it attempts multiple downloads before finally succeeding. Running with "options(renv.download.trace = TRUE); renv::restore()" gives the following, more detailed output:

- Downloading pillar from CRAN ...              
# Downloading 'https://bioconductor.org/packages/3.14/bioc/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz' [curl] --------

## Request -------------------------------------------------------------------
location
fail
silent
show-error
user-agent = "renv (1.0.11); R (4.1.3 x86_64-apple-darwin13.4.0 x86_64 darwin13.4.0)"
url = "https://bioconductor.org/packages/3.14/bioc/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz"
output = "/Users/thomaswalter/Library/Caches/org.R-project.R/R/renv/source/repository/pillar/renv-tempfile-15df37e7458c"
connect-timeout = "20"
retry = "3"

## Output --------------------------------------------------------------------
curl: (22) The requested URL returned error: 404

## Status --------------------------------------------------------------------
22

        ERROR [error code 22]
- Downloading pillar from CRAN ...              
# Downloading 'https://bioconductor.org/packages/3.14/data/annotation/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz' [curl] --------

## Request -------------------------------------------------------------------
location
fail
silent
show-error
user-agent = "renv (1.0.11); R (4.1.3 x86_64-apple-darwin13.4.0 x86_64 darwin13.4.0)"
url = "https://bioconductor.org/packages/3.14/data/annotation/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz"
output = "/Users/thomaswalter/Library/Caches/org.R-project.R/R/renv/source/repository/pillar/renv-tempfile-15df352d0cf26"
connect-timeout = "20"
retry = "3"

## Output --------------------------------------------------------------------
curl: (22) The requested URL returned error: 404

## Status --------------------------------------------------------------------
22

        ERROR [error code 22]
- Downloading pillar from CRAN ...              
# Downloading 'https://bioconductor.org/packages/3.14/data/experiment/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz' [curl] --------

## Request -------------------------------------------------------------------
location
fail
silent
show-error
user-agent = "renv (1.0.11); R (4.1.3 x86_64-apple-darwin13.4.0 x86_64 darwin13.4.0)"
url = "https://bioconductor.org/packages/3.14/data/experiment/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz"
output = "/Users/thomaswalter/Library/Caches/org.R-project.R/R/renv/source/repository/pillar/renv-tempfile-15df310ea90f0"
connect-timeout = "20"
retry = "3"

## Output --------------------------------------------------------------------
curl: (22) The requested URL returned error: 404

## Status --------------------------------------------------------------------
22

        ERROR [error code 22]
- Downloading pillar from CRAN ...              
# Downloading 'https://bioconductor.org/packages/3.14/workflows/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz' [curl] --------

## Request -------------------------------------------------------------------
location
fail
silent
show-error
user-agent = "renv (1.0.11); R (4.1.3 x86_64-apple-darwin13.4.0 x86_64 darwin13.4.0)"
url = "https://bioconductor.org/packages/3.14/workflows/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz"
output = "/Users/thomaswalter/Library/Caches/org.R-project.R/R/renv/source/repository/pillar/renv-tempfile-15df3188e4e57"
connect-timeout = "20"
retry = "3"

## Output --------------------------------------------------------------------
curl: (22) The requested URL returned error: 404

## Status --------------------------------------------------------------------
22

        ERROR [error code 22]
- Downloading pillar from CRAN ...              
# Downloading 'https://bioconductor.org/packages/3.14/books/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz' [curl] --------

## Request -------------------------------------------------------------------
location
fail
silent
show-error
user-agent = "renv (1.0.11); R (4.1.3 x86_64-apple-darwin13.4.0 x86_64 darwin13.4.0)"
url = "https://bioconductor.org/packages/3.14/books/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz"
output = "/Users/thomaswalter/Library/Caches/org.R-project.R/R/renv/source/repository/pillar/renv-tempfile-15df32001d31d"
connect-timeout = "20"
retry = "3"

## Output --------------------------------------------------------------------
curl: (22) The requested URL returned error: 404

## Status --------------------------------------------------------------------
22

        ERROR [error code 22]
- Downloading pillar from CRAN ...              
# Downloading 'https://lib.stat.cmu.edu/R/CRAN/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz' [curl] --------

## Request -------------------------------------------------------------------
location
fail
silent
show-error
user-agent = "renv (1.0.11); R (4.1.3 x86_64-apple-darwin13.4.0 x86_64 darwin13.4.0)"
url = "https://lib.stat.cmu.edu/R/CRAN/src/contrib/Archive/pillar/pillar_1.9.0.tar.gz"
output = "/Users/thomaswalter/Library/Caches/org.R-project.R/R/renv/source/repository/pillar/renv-tempfile-15df33d4dbbbf"
connect-timeout = "20"
retry = "3"

## Output --------------------------------------------------------------------
[no output generated]

## Status --------------------------------------------------------------------
0

OK [434.1 Kb in 0.29s]

It seems it tries to locate the package at four different bioconductor links before finally attempting CRAN. This only happens with CRAN packages, and does not happen with all of the CRAN packages. How can I configure renv to always search CRAN packages in CRAN on first attempt? Thanks in advance and let me know any other info I can give

Hi @thomaswalter, welcome to the community!

Do you ever need Bioconductor packages? The reason I ask is, I believe what you're seeing is that because BiocManager or similar is installed on your computer, then renv will try to use Bioconductor:

https://rstudio.github.io/renv/articles/renv.html#libraries-and-repositories

You can check if Bioconductor is available on your computer with the following:

> getOption("repos")
                       CRAN 
"https://cran.rstudio.com/" 
attr(,"RStudio")
[1] TRUE

In my case, I'm an infrequent R user with no background in Bio, so I don't have it installed.

Best,
Randy

Hi Randy, thank you for your reply. Yes, the project does use a number of Bioconductor packages, and BiocManager is used to manage and install these packages. The packages are then installed using renv by restoring from a pre generated lockfile, which contains all the necessary information on each package. Even with BiocManager, I'd like if renv could recognize when a package comes from CRAN and could immediately pull from that repository. Is there a place in the renv codebase where this interaction with BiocManager happens when installing packages via renv::restore(), that then causes renv to look at bioconductor even when CRAN is specified in the lockfile as the source for that package?

Thanks again for your help.

Unfortunately, I'm not sure how the solver processes things here, choosing one vs. the other. It might be the case that you can manually edit the lockfile to specify where you want the repos to come from:

{
  "R": {
    "Version": "3.6.1",
    "Repositories": [
      {
        "Name": "CRAN",
        "URL": "https://cloud.r-project.org"
      }
    ]
  },
  "Packages": {
    "markdown": {
      "Package": "markdown",
      "Version": "1.0",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "4584a57f565dd7987d59dda3a02cfb41"
    },
    "mime": {
      "Package": "mime",
      "Version": "0.7",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "908d95ccbfd1dd274073ef07a7c93934"
    }
  }
}

You could try switching any "Repository" not being CRAN over and see if that works. The hash might not match though, so you could be causing more issues than you solve.

Best,
Randy

It's possible that this might not even be an Renv thing, but rather the order these URLs are in:

Given that RStudio shows Up and Down in the Secondary repositories pane, maybe have Bioconductor after a few different CRAN mirrors, so that Bioconductor is like the 4th choice?

Hi Randy. It seems the issue was just fixed in the most recent renv release (Release renv 1.1.0 · rstudio/renv · GitHub):

  • Fixed an issue where renv::restore() did not respect the named repository
    within the lockfile when installing packages from the archives of the
    configured package repositories. (#2081)

Thank you for all your help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.