[R-pkg-devel] How to declare Bioconductor Dependencies in the Description File of my R Package

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Fri Mar 17 22:05:00 CET 2023


Packages can only be installed from the repositories listed and only CRAN is the default so only CRAN package are guaranteed to work. I'd like to add that the issue below is exactly why, personally, I would not recommend using Bioconductor package as strong dependency (imports/depends), because that makes the package unusable for most users, as it cannot be installed (without extra steps they don't know about) since the dependency doesn't exist on CRAN.

If your users are already Bioconductor users by the virtue of the package application then they already know so it's fine, but then you are probably better off to have your package on Bioconductor as part of the ecosystem which is much more streamlined and coordinated.

If it is only suggested (weak dependency) for some optional functionality, then your package will work even if the dependency is not installed so all is well. And if the optional Bioconductor functionality is used you can direct the user to instructions explaining that Bioconductor is required for that - but the package has to do that, it is not anything automatic in R.

Cheers,
Simon


> On Mar 18, 2023, at 1:29 AM, Ruff, Sergej <Sergej.Ruff using tiho-hannover.de> wrote:
> 
> Really.Whats a problem i have when all dependencies arent prei installed. I thought the problem would be solved once my package is available on CRAN.
> 
> 
> Here is a recent question I had regarding the same issue:
> 
> 
> I am currently working on a r-package. I would like to submit my r package to CRAN, but I have a question regarding dependency installations on CRAN.
> 
> I have almost finished my package, added the required dependencies to the NAMESPACE and DESCRIPTION files as Imports, and get no errors or warnings
> 
> when running the check in Rstudio. The package runs on the pc, where I´ve built the package, but when I install the package on a pc, where the dependencies
> 
> are not preinstalled, I get the following error:
> 
> ERROR:
> 
> dependencies 'depth', 'geometry' are not available for package 'packagename'
> * removing 'C:/Users/156932/AppData/Local/Programs/R/R-4.2.1/library/packagename'
> Warning in install.packages : installation of package ‘packagename’ had non-zero exit status
> 
> 
> The problem is that a local installation of my package (via USB-stick for example) can´t install the dependencies from CRAN.
> 
> The package works perfectly fine, if the dependencies are preinstalled.
> 
> Now I don´t want to submit my package to CRAN if the end user gets the same error message when installing my package.
> 
> Question: After I submit my package to CRAN, will CRAN install dependencies automatically (via "install.packages()"), resolving the issue I have right now?
> 
> Or do I have to modify the R-package or the Description-file to make sure my Package can install dependencies?
> 
> I provided the dependencies to the NAMESPACE-file as @ImportFrom via the devtools::document()-function. I added the dependencies to the DESCRIPTION-file via usethis::use_package("x",type="Imports"). The Description looks like this:
> 
> License: GPL (>= 3)
> Encoding: UTF-8
> LazyData: true
> RoxygenNote: 7.2.3
> Imports:
>    depth,
>    geometry,
>    graphics,
>    grDevices,
>    MASS,
>    mvtnorm,
>    nlme,
>    rgl,
>    stats
> 
> 
> 
> So I thought all dependencies would install automatically from CRAN? Is that not the case?
> 



More information about the R-package-devel mailing list