useBasiliskEnv {basilisk} | R Documentation |
Use basilisk environments for isolated execution of Python code with appropriate versions of all Python packages.
useBasiliskEnv(envpath)
envpath |
String containing the path to the basilisk environment to use. |
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.
tmploc <- file.path(tempdir(), "my_package_B") if (!file.exists(tmploc)) { setupBasiliskEnv(tmploc, c('pandas==0.25.1', "python-dateutil=2.8.0", "pytz=2019.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())