R/conda_greta_env.R

Defines functions have_greta_conda_env using_greta_conda_env use_greta_conda_env

use_greta_conda_env <- function() {
  tryCatch(
    expr = reticulate::use_condaenv("greta-env-tf2", required = TRUE),
    error = function(e) NULL
  )
}

using_greta_conda_env <- function() {
  config <- reticulate::py_discover_config()
  grepl("greta-env-tf2", config$python)
}

have_greta_conda_env <- function(){
  tryCatch(
    expr = "greta-env-tf2" %in% reticulate::conda_list()$name,
    error = function(e) FALSE
  )
}
greta-dev/greta documentation built on Dec. 21, 2024, 5:03 a.m.