2

How can I install the R 'sf' package on CentOS? On attempting to install, I initially got an error due to an out of date gdal package; I updated gdal (built from source following: http://trac.osgeo.org/gdal/wiki/BuildingOnUnix) and now have an error:

 checking GDAL: linking with --libs only... yes checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes checking GDAL: checking whether PROJ.4 is available for linking:... yes checking GDAL: checking whether PROJ.4 is available fur running:... ./gdal_proj: error while loading shared libraries: libgdal.so.20: cannot open shared object file: No such file or directory no configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ.4 not available? ERROR: configuration failed for package ‘sf’ 

I've tried creating a symlink to libgdal.so.20, but this doesn't change the error at all.

3 Answers 3

4
  1. Add /usr/local/lib to e.g. /etc/ld.so.conf.d/libgdal-x86_64.conf
  2. Run ldconfig
  3. Restart R
  4. Try again
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I was missing the ldconfig step!
If the file does not exist, feel free to create it.
1

@Dave has given exact steps & Please follow the below steps with some more explanation.

  1. Add /usr/local/lib to e.g. /etc/ld.so.conf.d/libgdal-x86_64.conf Please create the file libgdal-x86_64.conf if doesn't exists.

#echo "/usr/local/lib" >> /etc/ld.so.conf.d/libgdal-x86_64.conf

  1. Run ldconfig

#ldconfig

  1. Make sure you have GEOS,GDAL,PROJ installed on your system.

#yum install proj.x86_64 proj-devel.x86_64 proj-epsg.x86_64 proj-nad.x86_64 geos*

Try again

  1. Go to R cli & hit install.packages("sf")

Thanks hope this helps

1 Comment

Unfortunately, it didn't work for me! But I trying to install sf in Ubuntu OS. If you could help me here is the question: stackoverflow.com/q/67133013/4300670
0

For anyone else who has a multi-user/multi-computer environment with the need to have multiple versions of various pieces of software installed, I fixed my issue with:

install.packages('sf',configure.args='--with-gdal-config=/sw/gdal/2.2.3-gcc4/bin/gdal-config --with-proj-include=/sw/proj/4.9.3-gcc4/include --with-proj-lib=/sw/proj/4.9.3-gcc4/lib --with-proj-share=/sw/proj/4.9.3-gcc4/share/proj') 

Obviously you may/would have to alter path names from what I have.

1 Comment

could you please explain how to find the relative arguments ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.