cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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 @Retired_mod  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
Honored Contributor

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
Honored Contributor

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!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group