Trouble Installing "Sf" Due to "Gdal"

Trouble installing package sf in R (Big Sur)

The solution, thanks to @IRTFM, was to download the binary from CRAN, then use R CMD INSTALL. Then I could install tigris and tidycensus via install.packages()

How to download Sf package on MacOS

The error message lines "Warning in install.packages : downloaded length 68510897 != reported length 93022013" and "Timeout of 60 seconds was reached" suggests the package didn't download properly - this can occur when it takes longer than 60 seconds to download the package to your computer for installation i.e. the "timeout" of 60 seconds is reached.

One solution (the solution that worked in this case) is to increase the amount of time R will wait to download the package by running options(timeout = 1200) before running install.packages("sf")

If you need to build packages from source (with or without openMP) on an M1 mac, I believe the instructions posted here work: https://stackoverflow.com/a/68275558/12957340

Error installing R package sf 0.9.0 after updating gdal on macOS

Finally found a solution after many hours of digging here if anyone else comes across this problem.

gdal seems to cause an illegal operation during install.packages(sf) within RStudio-Server on a ArchLinux server

The problem is the arrow package.
https://github.com/apache/arrow/issues/12681

The solution: is to rebuild the arrow package manually with flags
-DARROW_SIMD_LEVEL=SSE4_2 or -DARROW_SIMD_LEVEL=NONE,
depending on the instructions set supported by your CPU

How install sf R's package or GDAL at CentOS 6.8

For those who landed on this page hoping to find instructions for installing "sf" on RHEL 7.5:

wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/u/udunits2-2.2.20-2.el7.x86_64.rpm
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/u/udunits2-devel-2.2.20-2.el7.x86_64.rpm
yum install udunits2-devel-2.2.20-2.el7.x86_64.rpm
yum install udunits2-2.2.20-2.el7.x86_64.rpm

wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/g/geos-3.4.2-2.el7.x86_64.rpm
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/g/geos-devel-3.4.2-2.el7.x86_64.rpm
yum install geos-*

wget http://download.osgeo.org/gdal/2.4.1/gdal-2.4.1.tar.gz
tar -zxvf gdal-2.4.1.tar.gz
cd gdal-2.4.1;
./configure; make -j4; make install
echo "/usr/local/lib" /etc/ld.so.conf.d/libgdal-x86_64.conf
ldconfig
cp -p /usr/local/lib/libgdal.so.20* /usr/lib64/

cd ../
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/proj-4.8.0-4.el7.x86_64.rpm
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/proj-devel-4.8.0-4.el7.x86_64.rpm
yum install proj-4.8.0-4.el7.x86_64.rpm proj-devel-4.8.0-4.el7.x86_64.rpm

Some lines might be redundant however this has worked for me.

installing sf package with libraries in non-standard locations

Thanks to all who comments; this issue was originated from CentOS's sudo settings. OS was set up that user environment variables will not be available in sudo environment, so setting an environment variable in user .bashrc file wouldn't solve the issue. Hence, to install sf package, I have to start R with sudo and with correct environment variables in command line, then install sf package in R.

First, run R with required environment variables,

sudo PKG_CONFIG_PATH="/home/programs/anaconda3/lib/pkgconfig/" LD_LIBRARY_PATH="/home/programs/anaconda3/lib" R

Second, install sf.

remotes::install_github("r-spatial/sf", configure.args = "--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-config=/home/programs/anaconda3/bin/geos-config --with-proj-include=/home/programs/anaconda3/include/ --with-proj-lib=/home/programs/anaconda3/lib/")

Again, excuse me for spending your time, I hope this post helps someone.

See: https://github.com/r-spatial/sf/issues/335#issuecomment-484985276



Related Topics



Leave a reply



Submit