Installing R packages is painful, but conda environment solved a lot of problems. Basically, if you install your own R in conda, and the later R command install.packages()
will automatically install the packages in the environment; in addition, conda has many system libraries too for getting away from requiring sudo permissions.
After creating an empty conda environment, you can install a specific version (say 4.2) of R by conda install -c conda-forge r-essentials=4.2
. If you are not sure whether that version exists in conda, you can do conda search r-essentials
. Using your own R in the conda environment, you can do the normal R installation commands.
Some R packages search system libraries by pkg-config. After you install the required libraries through conda, you can check whether your PKG_CONFIG_PATH
includes /envs//lib/pkgconfig, and set the path properly.