diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2024-04-07 15:01:35 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2024-04-07 15:01:35 +0200 |
commit | 1025fdbb55b0452c98ed55e7fa6399e2c99d72c0 (patch) | |
tree | db362f1e40e597e55ec3b529b923a746b0be1e62 /R | |
parent | 306c86a1821de2f54a15f44637eb481e9cc0c292 (diff) |
Improve reticulate startup code
Diffstat (limited to 'R')
-rw-r--r-- | R/chent.R | 1 | ||||
-rw-r--r-- | R/zzz.R | 8 |
2 files changed, 3 insertions, 6 deletions
@@ -24,7 +24,6 @@ #' if (!is.null(caffeine$Picture)) { #' plot(caffeine) #' } - chent <- R6Class("chent", public = list( #' @field identifier (`character(1)`)\cr @@ -1,11 +1,9 @@ .onLoad = function(libname, pkgname) { - rdkit_available <- FALSE + conf <- reticulate::py_discover_config("rdkit") + rdkit_available <- conf$available rdkit_module <- try( - reticulate::import("rdkit", delay_load = TRUE), + reticulate::import("rdkit"), silent = TRUE) - if (!inherits(rdkit_module, "try-error")) { - rdkit_available <- TRUE - } assign('rdkit_available', rdkit_available, envir = topenv()) assign('rdkit_module', rdkit_module, envir = topenv()) } |