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)

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!