Using libs from Anaconda Repository
You can use software packages and libraries from Anaconda Repository for IBM Cloud Pak for Data in RStudio.
Service Anaconda Repository for IBM Cloud Pak for Data is not available by default. An administrator must install this service.
To use packages and libraries from Anaconda Repository in RStudio:
-
Create channels, mirror packages and configure conda. See Configuring conda and creating channels.. The steps in the topic will create a
.condarcfile at/cc-home/_global_/config/conda. For example, the.condarccould look as follows:channel_alias: <ip address>/api/repo channels: - myDataScience default_channels: - <ip address>/api/repo/myDataScience -
Launch RStudio from your project and click the Terminal tab.
-
Verify that the
.condarcfile is loaded. Enter:conda infoExample of the response:
active environment : R-4.2-rt23.1 active env location : /opt/conda/envs/R-4.2-rt23.1 shell level : 1 user config file : /home/wsuser/.condarc populated config files : /opt/conda/.condarc /opt/conda/envs/R-4.2-rt23.1/.condarc conda version : 23.7.2 conda-build version : not installed python version : 3.10.13.final.0 virtual packages : __archspec=1=x86_64 __glibc=2.28=0 __linux=5.14.0=0 __unix=0=0 base environment : /opt/conda (writable) conda av data dir : /opt/conda/etc/conda conda av metadata url : None channel URLs : <ip address>/api/repo/myDataScience/linux-64 <ip address>/api/repo/myDataScience/noarch package cache : /opt/conda/pkgs /home/wsuser/.conda/pkgs envs directories : /opt/conda/envs /home/wsuser/.conda/envs platform : linux-64 user-agent : conda/23.7.2 requests/2.31.0 CPython/3.10.13 Linux/5.14.0-284.25.1.el9_2.x86_64 rhel/8.8 glibc/2.28 UID:GID : 1000770000:103000 netrc file : None offline mode : False -
You can now install packages from an R script file or the R console:
system('conda info') system('conda install <conda-packages>')For example, to install the
assertthatpackage enter:system('conda install r-assertthat') -
Verify that you can load the R packages from console by clicking the Packages tab and searching for the packages that you installed. If the packages are found and listed, they were successfully installed.
Parent topic: RStudio