Is conda enabled (active) in the current R session?
Source:R/system-check-scalar-isCondaEnabled.R
check-scalar-isCondaEnabled.Rd
Is conda enabled (active) in the current R session?
Arguments
- ignoreBase
logical(1)
. IfTRUE
, don't consider conda to be "active" if only the base environment is loaded. This is useful to avoid some false-positive situations when handling the main condaactivate
script in shell sessions.
Examples
vars <- c("CONDA_DEFAULT_ENV", "CONDA_SHLVL")
Sys.unsetenv(vars)
## TRUE ====
Sys.setenv(
"CONDA_DEFAULT_ENV" = "test",
"CONDA_SHLVL" = "2"
)
isCondaEnabled()
#> [1] TRUE
Sys.unsetenv(vars)
Sys.setenv(
"CONDA_DEFAULT_ENV" = "base",
"CONDA_SHLVL" = "1"
)
isCondaEnabled(ignoreBase = FALSE)
#> [1] TRUE
Sys.unsetenv(vars)
## FALSE ====
isCondaEnabled()
#> [1] FALSE
Sys.setenv(
"CONDA_DEFAULT_ENV" = "base",
"CONDA_SHLVL" = "1"
)
isCondaEnabled(ignoreBase = TRUE)
#> [1] FALSE
Sys.unsetenv(vars)