Skip to content

Instantly share code, notes, and snippets.

@hiraksarkar
Last active January 21, 2024 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiraksarkar/8dafdccba7dfac5e66cd3dea5e6e4997 to your computer and use it in GitHub Desktop.
Save hiraksarkar/8dafdccba7dfac5e66cd3dea5e6e4997 to your computer and use it in GitHub Desktop.
R_installation_instruction within conda

Basic

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.

@hiraksarkar
Copy link
Author

On mac you might need to do this sudo xcodebuild -license accept to use gcc/xcode.

@hiraksarkar
Copy link
Author

Maybe add CPPFLAGS = -DHAVE_WORKING_LOG1P in /Users/hs0424/miniforge3/envs/r43/lib/R/etc/Makeconf for the mac related error see conda-forge/r-base-feedstock#163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment