4.6 Conda Environment Best Practices

This section highlights the best practices for creating conda environments in OML4R to prevent R and third/fourth-party dependency conflicts.

R Version

To determine the latest R version being used, run the following command:
version

Note:

To prevent dependency conflicts, you can create a new environment and install all required packages simultaneously using the create command. This allows the solver to resolve all dependencies at once.

Admin Task: Create and Upload a Conda Environment

Use the create command to create a Conda environment named myrenv to install the forecast package. Specify the R version using the R parameter. Use the upload command to upload the myrenv environment to the Object Storage associated with the Autonomous Database instance for an OML user to download and use it.

Use the latest version of R available in OML Notebooks; in this example, we are using r-base=4.0.5.
%conda

create -n myrenv -c conda-forge --override-channels --strict-channel-priority r-base=4.0.5 r-forecast

upload myrenv --overwrite -t application "OML4R"

OML User: Use a Conda Enviroment

An OML user, you can download, activate, and use the environment in R paragraphs in notebooks:
%conda

download myrenv
activate myrenv
Import the forecast library:
%r

 library(forecast)