Difficulty installing packages, I think due to libs?




I am new to R and programming in general. I am having difficulty installing packages, I believe due to the path my library is taking but I am unsure how to fix it after trying various things. I was wondering if someone could help me. I amusing the latest version of R in Anaconda on Mac OS. see images below...



But, in this case, do you have libgit2 installed? This error is quite normal when you need to compile a package and you don't have a needed library. Try to install the missing library from Anaconda (if it is available) or from other sources (packages, macports, homebrew) and see if you still get an error.


Hi, I tried to donwload these too and I am told they are unavailable. I keep seeing this same error when trying to install various packages. I have also tried downloading from different sources in different ways and can't seem to get anywhere.


It seems that libgit2 is available through conda-forge channel, have you tried with it? If you get similar errors also for other libraries perhaps there is an issue with your system configuration possibly unrelated with RStudio.


@apcoyne, the error message in your screen shot indicates that a system dependency for compiling the R package is missing. Some R packages have components that need to be compiled. Sometimes they require shared libraries. Libgit2 is one such shared library. It's not present on your system, and needs to be in order to install the git2r package.

The error message indicates to use homebrew on OSX to install the library. What did you use to attempt to install libgit2?


I managed to get devtools to work. But this was just a means to an end to get a package from github that I am having a similar issue with. I am not sure if this is an issue on my system configuration. When I tru install sf by itself it won't run either. I really don't know what to do.


It looks like you need another system library for compiling the package you are trying to install via GitHub. Actually, the install is failing is when trying to install the sf package from source. sf is a dependency of the gtsfr package you want to install. Basically, this means you need to install the sf package to be able use gtsfr.

I've had some trouble in the past compiling sf on a Mac from source. So two things I would suggest you try:

  1. Install sf via CRAN with install.packages("sf") and then try to install gtsfr again.
  2. If that doesn't work, install GDAL 2.2 from here: http://www.kyngchaos.com/software/frameworks/ and then try to install gtsfr again.


Dropping in with a tiny note:

We encourage everyone to paste in console output rather than posting screenshots. This is better for searching and better for reading. Please save screenshots for problems that can't be shown any other way.

When you paste the output, make sure to format it as code:sparkles: so it comes through correctly — you can use the little </> button at the top of the posting box. :grin: