Skip to content Skip to sidebar Skip to footer

How To Install Gdal Library In Docker Python Image?

I'm using python3.7-slim-buster docker image for my django project. Now I want to use Geo features of django. But it seems I have to install GDAL. So, I do RUN apt-get install gdal

Solution 1:

you need to do the following:

RUN apt-getupdate
RUN apt-get install -y software-properties-common && apt-getupdate
RUN apt-get install -y python3.7-dev
RUN  add-apt-repository ppa:ubuntugis/ppa &&  apt-getupdate
RUN apt-get install -y gdal-bin libgdal-dev
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip install GDAL

Solution 2:

That's because your image doesn't have repository which contain gdal-bin package. So you have to add repository (you can see the guideline here) and install it:

RUN add-apt-repository ppa:ubuntugis/ppa && apt-getupdate&& apt-get install -y gdal-bin python-gdal python3-gdal

Solution 3:

If you can use other base image, here is one with gdal installed:

FROM osgeo/gdal:ubuntu-small-3.2.0

Post a Comment for "How To Install Gdal Library In Docker Python Image?"