rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
1.02k stars 155 forks source link

bioconductor version mismatch #1943

Open chubukov opened 5 months ago

chubukov commented 5 months ago

I can't seem to install a newer version of Bioconductor. Is this an renv issue or something I'm misunderstanding about Bioconductor versions?

> renv::init(bioconductor="3.18")
- Using Bioconductor version '3.18'.
- Lockfile written to "~/test_renv_1/renv.lock".

Restarting R session...

- Project '~/test_renv_1' loaded. [renv 1.0.5]
> renv::settings$bioconductor.version()
[1] "3.18"
> BiocManager::version()
[1] ‘3.16’
> find.package("BiocManager")
[1] "/home/vchubukov/test_renv_1/renv/library/R-4.2/x86_64-pc-linux-gnu/BiocManager"
chubukov commented 5 months ago

I think I understand the issue now.

>BiocManager::install(version="3.18")
Error: Bioconductor version '3.18' requires R version '4.3'; use `version = '3.16'` with R version 4.2; see
https://bioconductor.org/install

Maybe then the suggestion is just for better feedback when the user asks for an invalid version.

kevinushey commented 4 months ago

What is the output of renv:::renv_bioconductor_repos() in your project? Those should still be appropriately set based on the version you selected, I believe -- although it's still possible that the packages in that repository won't be compatible with your version of R.

The other thing that renv could try to do is install an appropriate version of the BiocVersion package, since the BiocManager uses the existence of that package as a signal it should use a specific version of Bioconductor.

chubukov commented 4 months ago

Thanks Kevin

> renv:::renv_bioconductor_repos()
                                                          BioCsoft 
                     "https://bioconductor.org/packages/3.18/bioc" 
                                                           BioCann 
          "https://bioconductor.org/packages/3.18/data/annotation" 
                                                           BioCexp 
          "https://bioconductor.org/packages/3.18/data/experiment" 
                                                     BioCworkflows 
                "https://bioconductor.org/packages/3.18/workflows" 
                                                         BioCbooks 
                    "https://bioconductor.org/packages/3.18/books" 
                                                              RSPM 
"https://packagemanager.rstudio.com/all/__linux__/bullseye/latest" 
                                                              CRAN 
                                      "https://cran.r-project.org" 

So yes, as you said -- set based on the version I selected but incompatible with my version of R.

Feels to me like selecting an incompatible version should just throw an error, if it's possible to assess.

kevinushey commented 4 months ago

Thanks -- I implemented something in https://github.com/rstudio/renv/commit/5e2cccd817433992a93f3e36ddf1b689bde85cff, so you should now see something like:

The requested version of Bioconductor is not compatible with this version of R.
You are using R 4.4.1, for which Bioconductor version(s) '3.19', '3.20' are available.

Would you still like to use this version of Bioconductor? [y/N]: 

So you still have the option of attempting to proceed with the (potentially bad) version of Bioconductor, but we report when this happens.