cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to install sf and rgeos R packages on the cluster

User16753724663
Valued Contributor

Got following error

java.lang.RuntimeException: Installation failed with message:

Error installing R package: Could not install package with error: installation of package ‘rgdal’ had non-zero exit status
 
Full error log available at /databricks/driver/library-install-logs/r-package-installation-rgdal-2021-05-10T09:12:47Z-_1XBW4.log
 
 
 
Error installing R package: Could not install package with error: installation of package ‘rgdal’ had non-zero exit status
 
Full error log available at /databricks/driver/library-install-logs/r-package-installation-rgdal-2021-05-10T09:12:47Z-iT1LlL.log;

1 REPLY 1

User16753724663
Valued Contributor

We can use the below init script to install the packages in the cluster:

%scala
 
dbutils.fs.put("dbfs:/databricks/init_scripts/rlib.sh", """
 
#!/bin/bash
 
sudo apt-get install -y libudunits2-dev
 
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
 
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev
 
sudo apt-get install -y libfontconfig1-dev
 
sudo apt-get install -y libcairo2-dev
 
sudo apt-get install -y libprotobuf-dev
 
sudo apt-get install -y protobuf-compiler
 
sudo add-apt-repository -y ppa:opencpu/jq
 
sudo apt-get install -y libjq-dev
 
sudo apt-get install -y libv8-dev
 
R -e 'install.packages(c("rgdal", "RJDBC", "sf", "rgeos"), dependencies = T, repos = "https://cran.r-project.org")'
 
""",true)

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