Hateful dependencies...in R

Install R and Rstudio in Linux is mostly an agony due post compilation problems… Imagine have an old computer (circa 2015), waste 30 minutes waiting for an installation of two packages (not even the tidyverse), but at the end you only get multiple errors in the console due inexisting dependencies. That’s the reason for posting here some helpful commands/dependencies to install before the main installation.

Source: stackoverflow.com

The Basics

Installing R and Rstudio… You can follow the instructions available in the official CRAN notes or searching in google for more specific instructions according to your distro o for some specific version. To me is not a big deal what R version you have because in my experience the main part is in the package, not in the entire program, so, here are some instructions how to install R on Linux Mint 21.

  1. Installing some dependencies to Run R and Rstudio

sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common -y

  1. Authenticate previous dependencies

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

  1. Addin CRAN repository and update package list

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/' && sudo apt update

  1. Installing R

sudo apt install r-base -y

  1. Installing Rstudio Download the “.deb” package from the official page and installing with:

sudo gdebi rstudio*.deb

Most important, the dependencies

After installing R and Rstudio it’s necessary install the following dependencies. These dependencies are necessary for CRAN packages compilation (especially for these in the tidyverse), saving us a lot of time.

sudo apt install libfontconfig1-dev libcurl4-openssl-dev libxml2-dev libssl-dev libudunits2-dev libgdal-dev libpoppler-cpp-dev libmagick++-dev libjq-dev libprotobuf-dev protobuf-compiler libharfbuzz-dev libfribidi-dev

That’s all.

Bonus: you can dig in this repo and see if this method is better for you.

https://github.com/eddelbuettel/r2u


Credits

Pictures created with Dall-E 2

 Share!

 
comments powered by Disqus