cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Install R Package "sf"

thethirtyfour
New Contributor III

Hi,

I am trying to install the following four dependency packages in order to install "slu-openGIS/postmastr" directly from GitHub:

  • units
  • sf
  • tigris
  • tidycensus

When attempting to install "units", I received the following configuration error:

 

%r
install.packages("units")

  Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)

 

I was able to install this package as follows, based on @Kaniz  response:

 

%r
system("sudo apt-get install libudunits2-dev -y")
install.packages("units")

 

 However, I receive the below error when attempting to install the "sf" package. Can someone please assist? 

Thank you!

 

%r
install.packages("sf")

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++17
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/local_disk0/.ephemeral_nfs/envs/rEnv-2f880f79-1361-4a3a-92e5-62a9d12ddcce/sf’
Installing package into ‘/local_disk0/.ephemeral_nfs/envs/rEnv-2f880f79-1361-4a3a-92e5-62a9d12ddcce’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-15.tar.gz'
Content type 'application/x-gzip' length 3485450 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

Warning in utils::install.packages(pkgs, ...) :
  installation of package ‘sf’ had non-zero exit status

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

feiyun0112
Contributor III

For Unix-alikes, GDAL (>= 2.0.1), GEOS (>= 3.4.0) and Proj.4 (>= 4.8.0) are required.

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev libsqlite0-dev

https://github.com/r-spatial/sf?tab=readme-ov-file#ubuntu 

View solution in original post

2 REPLIES 2

feiyun0112
Contributor III

For Unix-alikes, GDAL (>= 2.0.1), GEOS (>= 3.4.0) and Proj.4 (>= 4.8.0) are required.

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev libsqlite0-dev

https://github.com/r-spatial/sf?tab=readme-ov-file#ubuntu 

thethirtyfour
New Contributor III

Thank you!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.