[R-pkg-devel] NOTE related to Miniconda installation

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sat Sep 18 02:08:22 CEST 2021


On 17/09/2021 2:55 p.m., Walter, Vonn 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.
> 

The help page ?.onLoad suggests it should normally be silent.  Users 
might not know which package your message came from, because loading can 
happen indirectly, if some other package they requested imports from 
yours, for instance.

So if you put your startup message on .onAttach, you probably won't get 
the note.

Duncan Murdoch


> 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 using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



More information about the R-package-devel mailing list