1

I recently installed the latest version of R (3.4.0) and installed all of my packages, but for some reason rgdal will not load and I'm getting this message:

library(rgdal) Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgdal/libs/rgdal.so': dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgdal/libs/rgdal.so, 6): Library not loaded: /Builds/unix/recipes/build/gdal-2.1.3-obj/libgdal.dylib Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgdal/libs/rgdal.so Reason: image not found

I went to the rgdal/libs directory and the rgdal.so file exists, but for some reason doesn't want to load. Anyone else have this issue or a similar one?

Vaughn Smith
  • 23
  • 1
  • 3
  • One thing you could try is to change the CRAN mirror from `Global (CDN) - RStudio` to other sources. In your RStudio, go to `Tool`, `Global Option`. `Package`, and change the source. – www Apr 27 '17 at 20:19
  • 1
    Possibly related: http://stackoverflow.com/questions/43662421/unable-to-load-pgirmess-library-image-not-found-r-3-4-in-mac-os?noredirect=1#comment74373472_43662421. Looks like you are also on a Mac. – MrFlick Apr 27 '17 at 20:24
  • Do you use homebrew? – hrbrmstr Apr 27 '17 at 21:56

3 Answers3

1

Try installing RStudio and re-download it from there or type install.packages("rgdal"). If none of these work try installing another package and see if you can run it, because it is either the directory, the package or the version of the package is not compatible with the version of the language.

Ka_Papa
  • 137
  • 9
  • I am currently using RStudio and installed the latest version of that as well (sorry forgot to mention that). I am just going to try uninstalling R and RStudio, then redownload and reinstall them both. Hopefully that should do the trick, unless you think this might cause further issue. – Vaughn Smith Apr 27 '17 at 20:13
  • If you have privileges in that folder and you have the latest versions it shouldn't matter, but last time I had a similar issue with R I just had to reboot my computer, so try that. I'll try to see if that happens to me as well in the mean time. – Ka_Papa Apr 27 '17 at 20:28
1

Do you have GDAL OS X frameworks installed? If not, go to William Kyngesburye's site, download and install frameworks in the following order:

  1. GDAL Complete
  2. GSL Framework
  3. FreeType
  4. cairo

After completing this installation, go for steps 2 and 3 of this answer, and then, install rgdal from R.app using these specifications in the install.packages command.

It solved the problem for me, hope it helps you!

Community
  • 1
  • 1
Juan Enciso
  • 310
  • 2
  • 7
0

Seems to be related to my issue posted same day, Unable to load pgirmess library ("image not found") - R 3.4 in Mac OS .

I installed the previous version of R from CRAN (3.3.3), and it works fine. You can have both versions installed at the same time. Maybe not a long term solution but at least a temporary fix so your work can continue.

Community
  • 1
  • 1