cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

GDAL on Databricks Cluster Runtime 12.2 LTS

NC
New Contributor III

I need gdal in my course work.

After reading this post, I used init script as follows to install gdal into runtime 12.2 LTS

 

 

dbutils.fs.put("/databricks/scripts/gdal_install.sh","""
#!/bin/bash
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install -y cmake gdal-bin libgdal-dev python3-gdal""",
True)

 

 

 

The init script ran and cluster could start properly but when i run import gdal in notebook, i get the following error:

ModuleNotFoundError: No module named 'gdal'

I also tried installing gdal into the cluster via Maven repository, it does not work either.

May I know what I can do to get gdal installed properly?

Thank you.

 

 

 

 

 

 

 

 

 

 

 

3 REPLIES 3

Debayan
Esteemed Contributor III
Esteemed Contributor III

Hi, Could you please confirm if apt get install gdal was already tried? 

You can try as below: 

apt-get update && apt-get upgrade; apt-get install gdal*;

Please tag @Debayan with your next comment, which will get me notified. Thanks!

NC
New Contributor III

Hi @Debayan

Do you mean this:?

dbutils.fs.put("/databricks/scripts/gdal_install.sh","""
#!/bin/bash
apt-get update && apt-get upgrade
apt-get install gdal*

""", True)

 

Debayan
Esteemed Contributor III
Esteemed Contributor III

Hi, I think I understood the issue, for the no module found error sometimes you need to clean the apt list , something like below: 

%sh
rm -r /var/cache/apt/archives/* /var/lib/apt/lists/*
sudo apt-get clean
sudo apt-get update
sudo add-apt-repository -y ppa:ubuntugis/ppa && apt-get update
sudo apt-get install -y gdal-bin libgdal-dev (or gdal*)

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!