View source: R/useBasiliskEnv.R
useBasiliskEnv | R Documentation |
Use basilisk environments for isolated execution of Python code with appropriate versions of all Python packages.
useBasiliskEnv(envpath, full.activation = NA)
envpath |
String containing the path to the basilisk environment to use. |
full.activation |
Logical scalar, see |
It is unlikely that developers should ever need to call useBasiliskEnv
directly.
Rather, this interaction should be automatically handled by basiliskStart
.
This function will modify a suite of environment variables as a side effect
- see “Persistence of environment variables” in ?basiliskStart
for the rationale.
The function will attempt to load the specified basilisk environment into the R session,
possibly with the modification of some environment variables (see Details).
A NULL
is invisibly returned.
Aaron Lun
basiliskStart
, for how these basilisk environments should be used.
if (.Platform$OS.type != "windows") {
tmploc <- file.path(tempdir(), "my_package_A")
if (!file.exists(tmploc)) {
setupBasiliskEnv(tmploc, c('pandas==1.4.3'))
}
# This may or may not work, depending on whether a Python instance
# has already been loaded into this R session.
try(useBasiliskEnv(tmploc))
# This will definitely not work, as the available Python is already set.
baseloc <- basilisk.utils::getCondaDir()
status <- try(useBasiliskEnv(baseloc))
# ... except on Windows, which somehow avoids tripping the error.
stopifnot(is(status, "try-error") || basilisk.utils::isWindows())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.