I can't really see why it should be "recommended" to handle installing system 
requirements inside an R package. There are many ways to satisfy such 
requirements that would not involve miniconda. If you were determined to 
provide such support, doing so in a normal function documented in a vignette 
seems more appropriate.

On September 17, 2021 11:55:07 AM PDT, "Walter, Vonn" 
<vwalt...@pennstatehealth.psu.edu> wrote:
>Hi Everyone,
>
>I am developing a package (called mypackage in the text below) that uses 
>reticulate to call a Python script for computational efficiency.  At some 
>point during the development of the package I read that it would be good to 
>verify installation of Miniconda.  Thus mypackage includes an onLoad.R file 
>that asks users to either confirm that Miniconda is installed or to proceed 
>with installation on Miniconda.  When I run devtools::check() I get a NOTE 
>related to my onLoad.R file, and this seems to be causing problems when I 
>submit the package to CRAN.  There are no WARNINGs or ERRORs.  Any thoughts 
>would be greatly appreciated.
>
>Thanks,
>
>Vonn
>
>* checking R code for possible problems ... [19s] NOTE
>File 'mypackage/R/onLoad.R':
>  .onLoad calls:
>    packageStartupMessage("You should install miniconda before using this 
> package")
>
>See section 'Good practice' in '?.onAttach'.
>
>Here's the code/text from my onLoad.R file:
>
>#' Perform necessary tasks when the mypackage package is loaded
>#'
>#'
>miniconda_installation <- NULL
>miniconda_permission <- NULL
>numpy_import <- NULL
>
>.onLoad <- function(libname, pkgname)
>                {
>                miniconda_installation <- utils::askYesNo("Is miniconda 
> installed?")
>
>                if (isFALSE(miniconda_installation))
>                                {
>                                miniconda_permission <- 
> utils::askYesNo("Install miniconda?  Downloads 50MB and takes time.")
>
>                                if (isTRUE(miniconda_permission))
>                                                {
>                                                reticulate::install_miniconda()
>                                                } else{
>                                                                
> packageStartupMessage("You should install miniconda before using this 
> package")
>                                                                }
>
>                                numpy_import <- reticulate::import("numpy", 
> delay_load = TRUE)
>                                }
>                }
>
>
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-package-devel@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
Sent from my phone. Please excuse my brevity.

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to