View source: R/activateEnvironment.R
activateEnvironment | R Documentation |
Mimic the (de)activation of a Conda environment by modifying environment variables in the current R process.
activateEnvironment(envpath = NULL, full.activation = NA, loc = getCondaDir())
deactivateEnvironment(listing)
envpath |
String containing the path to the Conda environment to activate.
If |
full.activation |
Logical scalar indicating whether the
|
loc |
String containing the path to the root of a conda instance. |
listing |
Named list of strings containing name:value pairs for environment variables,
typically the output of |
Conda environments generally need to be activated with the conda activate
command to function properly.
This is especially relevant on Windows where the "PATH"
variable needs to be modified for the DLL search.
When performing full activation, the activateEnvironment
function mimics the effect conda activate
by modifying environment variables in the current R session.
This can be reversed by deactivateEnvironment
once the Conda environment is no longer in use.
The activateEnvironment
function will also unset a few bothersome environment variables:
"PYTHONPATH"
: to avoid compromising the version guarantees
if reticulate's import
is allowed to search other locations beyond the specified Conda environment.
"PYTHONNOUSERSITE"
: similarly, to avoid searching the user's site libraries.
"RETICULATE_PYTHON"
: this would otherwise override any choice of Python,
even after explicit specification via reticulate's use_Condaenv
!
"RETICULATE_PYTHON_ENV"
: for similar reasons.
activateEnvironment
will modify environment variables to mimic activation of the Conda environment.
It returns a named list of the previous values of all variables modified in this manner.
(NA
values indicate that the corresponding variable was not previously set.)
deactivateEnvironment
restores the environment variables to their pre-activation state.
It returns NULL
invisibly.
Aaron Lun
# We can't actually run activateEnvironment() here, as it
# either relies on basilisk already being installed or
# it has a hard-coded path to the basilisk system dir.
print("dummy test to pass BiocCheck")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.