Installing gdal >2.0.1 to work with RStudio in CentOS 7 in order for the sf package to install successfully

I'm trying to install gdal >2.0.1 and configure it with RStudio so that I can install the sf package.
I'm on CentOS 7.

First, I tried installing gdal using the below code and it successfully installed gdal version 1.11.4

sudo yum install gdal
sudo yum install gdal gdal-devel

Then I followed the steps in the answer of the below post to upgrade to version 2.4.0:

The steps were:

sudo yum-builddep gdal
wget http://download.osgeo.org/gdal/2.4.0/gdal-2.4.0.tar.gz
tar xf gdal-2.4.0.tar.gz
cd gdal-2.4.0/
./configure
make -j4
sudo make install
# make sure the library can be found
echo /usr/local/lib | sudo tee -a /etc/ld.so.conf.d/local.conf
sudo ldconfig

This installed version 2.4.0 successfully on the machine, however RStudio is not able to detect this version.

Running the below line in RStudio, returns: "1.11.4"

system2("gdal-config","--version")

How can I configure RStudio to detect the updated gdal?

Mixing two versions of a library on one system can be difficult. You could get rid of the version installed via yum if you don't need it:

sudo yum erase gdal gdal-devel

After that the newer version should be found.

1 Like

That worked! Thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.