set_reticulate_python {GeneSelectR} | R Documentation |
Set RETICULATE_PYTHON for the Current Session
Description
This function sets the RETICULATE_PYTHON environment variable to the path of the Python interpreter in the specified Conda environment, but only for the current R session. The change will not persist after the R session is closed.
Usage
set_reticulate_python(env_name = "GeneSelectR_env")
Arguments
env_name |
The name of the Conda environment. Default is 'GeneSelectR_env'. |
Details
This function checks if the specified Conda environment exists. If it does, the function sets the RETICULATE_PYTHON environment variable to the path of the Python interpreter in that environment. If the environment does not exist, the function stops with an error message.
Users need to run this function in every new R session where they want to use your package. Also, they should run this function before loading your package with library(), because the RETICULATE_PYTHON environment variable needs to be set before reticulate is loaded.
Value
This function does not return a value. Instead, it sets the RETICULATE_PYTHON environment variable for the current R session and prints a message indicating the new value of RETICULATE_PYTHON. If the specified environment does not exist, the function stops with an error message.
Examples
set_reticulate_python('GeneSelectR_env')