2

I mostly work in Python to do data analysis, but am trying to learn R stats as well. Python, Pandas, etc are installed via Anaconda on my Mac laptop.

Today I downloaded R Studio onto my laptop, and tried running install.packages("tidyverse") to get started in R. I ran into this error:

ERROR: dependencies ‘rvest’, ‘xml2’ are not available for package ‘tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

After Googling for a while I came across a few instances of this exact or similar issue. However, the solutions are not for Mac, e.g.,

sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev

It turns out Anaconda has already installed libcurl, libxml2 and openssl for me. Is there a way to get Rstudio to ... "look" (?) ... for the compiled libraries it needs where Anaconda has installed them?

1 Answers1

0

If you know where the libraries are (say /my/lib/path) then you could use withr::with_makevars to supplement the library search path. Something like

library(withr)

with_makevars(c(PKG_LIBS="-L/my/lib/path"), install.packages("tidyverse"), assignment="+=")

Personally, I would try to limit this to only the specific packages in tidyverse that are failing, and not the whole umbrella package.

merv
  • 42,696
  • 7
  • 122
  • 170