#' Python Modules Check
#'
#' Check to see if required Python modules are installed and if not, send an error message.
#' @keywords reticulate
#' @export
#' @examples
#' pythonModulesCheck()
pythonModulesCheck <- function() {
missingModuleStopper <- function(module_name) {
if (!reticulate::py_module_available(module_name)) {
stop(paste0("The ", module_name, " Python package is not installed. Install it using cmd: 'pip install ", module_name, "'"))
}
}
pythonModuleList <- list(
"pandas",
"re",
"spacy",
"rank_bm25",
"tqdm",
"pickle",
"numpy",
"gensim",
"os",
"nmslib",
"time")
lapply(pythonModuleList, missingModuleStopper)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.