Error loading rgdal


I have successfully installed the rgdal package along with the dependencies GDAL and Proj4. After installation I succesfully loaded the package in R with the library function. However after my most recent login when i type in the command library(rgdal) I get an error message:

Error: package or namespace load failed for 'rgdal' in dyn.load(file, 
DLLpath = DLLpath, ...):
unable to load shared object '/home/nikhail1/R/x86_64-pc-linux-gnu-
library/3.4/rgdal/libs/': cannot open shared object file: No such file or directory

I understand this means there is no link to the libgdal file but I am not sure how to fix it. is in the system under /home/nikhail1/bin/gdal/lib/. The file is under the rgdal folder in the R library in my /home/nikhail1/ system. I do not have the authority to perform an ldconfig function on shared libraries (I am a novice). Does anyone have a function that could help me make the system recognize the pathway to I am working on a Linux CentOs 6.9 system. I cannot perform any sudo apt-get, yum or brew functions.

Many thanks, Nikhail


You can set LD_LIBRARY_PATH to include /home/nikhail1/bin/gdal/lib, i.e. in bash

export LD_LIBRARY_PATH="/home/nikhail1/bin/gdal/lib:$LD_LIBRARY_PATH"
ldd /home/nikhail1/R/x86_64-pc-linux-gnu-library/3.4/rgdal/libs/

should report as been found. How to make this persistent depends on your desktop environment.

Answered By – Ralf Stubner

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published