Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiocVersion recorded in lockfile but not used in this project #1356

Closed
lucygarner opened this issue May 28, 2023 · 12 comments · Fixed by #1408
Closed

BiocVersion recorded in lockfile but not used in this project #1356

lucygarner opened this issue May 28, 2023 · 12 comments · Fixed by #1408
Labels
bug an unexpected problem or unintended behavior status 🔮

Comments

@lucygarner
Copy link

Hi,

I am getting the message that BiocVersion "recorded in the lockfile, but do not appear to be used in this project".
"Use renv::snapshot() if you'd like to remove these packages from the lockfile."

image

However, when I run renv::snapshot(), it says "The lockfile is already up to date". Is this something specific about the BiocVersion package?

Best wishes,
Lucy

sessionInfo()

R version 4.3.0 (2023-04-21)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.3.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

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

loaded via a namespace (and not attached):
[1] compiler_4.3.0      BiocManager_1.30.20 tools_4.3.0         rstudioapi_0.14    
[5] yaml_2.3.7          renv_0.17.3   
@hadley
Copy link
Member

hadley commented May 30, 2023

Can you provide at least a rough reprex of your current package state?

@hadley hadley added the reprex needs a minimal reproducible example, or otherwise waiting for response label May 30, 2023
@kevinushey
Copy link
Collaborator

I think we need to pick up BiocVersion as an "implicit" dependency of projects using Bioconductor, because no packages will explicitly depend on it but users can install a specific version of the BiocVersion package to implicitly depend on a specific Bioconductor release. At least, that's my understanding based on https://bioconductor.org/packages/release/bioc/html/BiocVersion.html.

@kevinushey
Copy link
Collaborator

BiocManager is a similar type of dependency here.

@lucygarner
Copy link
Author

lucygarner commented May 30, 2023

Can you provide at least a rough reprex of your current package state?

What would be the most useful thing to have? A copy of the renv.lock file?

renv.lock (contents of the renv.lock file as a txt file)

I am trying to find a simple way to recreate the issue, but haven't yet managed. I am getting the same message for another one of my projects though. It only seems to happen since I've upgraded to R 4.3.0 and therefore also upgraded Bioconductor versions (3.17).

@lucygarner
Copy link
Author

I have managed to recreate the issue with the following code:

renv::init()

renv::install("BiocManager")
BiocManager::install("scuttle")

renv::snapshot()

BiocManager::install("clusterProfiler")

renv::snapshot()

The issue only appears after I then restart my R session. I have a separate packages.R file which loads the scuttle and clusterProfiler packages.

@lucygarner
Copy link
Author

I think we need to pick up BiocVersion as an "implicit" dependency of projects using Bioconductor, because no packages will explicitly depend on it but users can install a specific version of the BiocVersion package to implicitly depend on a specific Bioconductor release. At least, that's my understanding based on https://bioconductor.org/packages/release/bioc/html/BiocVersion.html.

Just to say that BiocVersion was installed as a dependency of another package, rather than me explicitly installing it.

@kevinushey
Copy link
Collaborator

For reference:

> tools::package_dependencies("BiocVersion", reverse = TRUE)
$BiocVersion
[1] "AnnotationHub" "pkgndep"      

But, at least from the lockfile, it doesn't look like your project depends on AnnotationHub?

@hadley
Copy link
Member

hadley commented Jun 2, 2023

I can't reproduce the problem with this reprex script:

renv::init()

renv::install("bioc::scuttle")
writeLines("library(scuttle)", "dep-1.R")
renv::snapshot()

renv::install("bioc::clusterProfiler")
writeLines("library(clusterProfiler)", "dep-2.R")
renv::snapshot()

renv:::renv_restart_request(".")
renv::snapshot()

I switch to using renv::install() since there are SO many packages to install and the cache makes a big difference.

@hadley
Copy link
Member

hadley commented Jun 2, 2023

Oh because your reprex doesn't include status() which is the actual source of the problem.

@hadley
Copy link
Member

hadley commented Jun 2, 2023

Ok, here's a reprex that shows the problem — it appears to be caused by taking and then removing a BioC dependency:

renv::init()

renv::install("bioc::BiocGenerics", prompt = FALSE)
writeLines("library(BiocGenerics)", "deps.R")
renv::snapshot(prompt = FALSE)

unlink("deps.R")
renv::snapshot(prompt = FALSE)
renv::status()
The following package(s) are installed, but not recorded in the lockfile:

- BiocManager [1.30.20]

Use `renv::snapshot()` to add these packages to the lockfile.

It's not exactly the same package, but the problem seems like it's in the same ballpark.

@hadley
Copy link
Member

hadley commented Jun 2, 2023

And that arises because of this special case:

renv/R/status.R

Lines 186 to 189 in e1953d0

sources <- extract_chr(library, "Source")
if ("Bioconductor" %in% sources)
packages <- unique(c(packages, "BiocManager"))

It feels like that logic should involve packages (what's used), not just library (what's installed).

And possibly this too:

renv/R/snapshot.R

Lines 925 to 931 in e1953d0

sources <- extract_chr(kept, "Source")
if ("Bioconductor" %in% sources) {
packages <- c("BiocManager", "BiocInstaller", "BiocVersion")
for (package in packages)
kept[[package]] <- records[[package]]
}

@lucygarner
Copy link
Author

Oh because your reprex doesn't include status() which is the actual source of the problem.

Interesting. I didn't have to run status() for the message to show up.

hadley added a commit that referenced this issue Jun 8, 2023
Includes new `renv_tests_scope_system_cache()` to make it easier to install packages from the system cache to speed up performance in tests.

Fixes #1356
@hadley hadley added bug an unexpected problem or unintended behavior status 🔮 and removed reprex needs a minimal reproducible example, or otherwise waiting for response labels Jun 8, 2023
@hadley hadley closed this as completed in 0041b6d Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior status 🔮
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants