Skip to contents

Check for an active python environment without initialization. If none initialized, FALSE is returned. If an initialized environment is found, the env name based on reticulate::conda_list() will be returned

Usage

py_active_env()

Value

boolean

Examples

py_active_env
#> function () 
#> {
#>     name <- python <- NULL
#>     if (!reticulate::py_available()) {
#>         options(giotto.py_active_env = FALSE)
#>         return(FALSE)
#>     }
#>     env_cache <- getOption("giotto.py_active_env", FALSE)
#>     if (is.character(env_cache)) {
#>         return(env_cache)
#>     }
#>     py_conf <- reticulate::py_config()
#>     py_path <- py_conf$python
#>     py_ver <- py_conf$version
#>     py_tab <- data.table::setDT(reticulate::conda_list())
#>     py_name <- py_tab[dirname(python) == dirname(py_path), name]
#>     if (length(py_name) == 0) 
#>         py_name <- py_path
#>     options(giotto.py_active_env = py_name)
#>     options(giotto.py_active_ver = py_ver)
#>     return(py_name)
#> }
#> <bytecode: 0x55cc04d4aed0>
#> <environment: namespace:GiottoUtils>