Skip to main content

This Python package and extensions are a number of tools for programming and manipulating the GDAL Geospatial Data Abstraction Library. Generally speaking the classes and methods mostly match those of the GDAL and OGR C++ classes.

A basic starting point is the Vector API Tutorial. For full documentation, see the GDAL Python API.

The GDAL Python package is built using SWIG. The GDAL project maintains these Python bindings for GDAL/OGR within the gdal source tree. The SWIG-generated files are not checked in and are not part of the gdal release tarballs. The bindings are also made available via PyPi where the swig-generated files are provided.

Building from source

To build from source, there are multiple possible paths.

Dependencies

(As usual, when a package is listed one needs the parts used to build programs against it, called -devel on many systems. This is not special about gdal.)

  • SWIG (4 or greater).

  • libgdal (3.13.3 or greater).

  • numpy (1.0.0 or greater). This is not force-required by the build, but many examples and utilities will not work without it. At least osgeo.gdal_array requires numpy at build time; building without numpy and installing it later does not result in correct operation. apparently not and in any case it is an unwarranted leap.

  • setuptools (python)

  • wheel (python)

Building when building the rest of GDAL

Python bindings are generated by default when building GDAL from source. For more detail, see Python bindings options

Building just the bindings, from the full tree

Another is to use the gdal source distribution with an already-installed gdal library and headers. To do this, one must create a build directory and run cmake to generate build scripts. Then, run cmake --build . --target python_generated_files. Finally, in swig/python, one can build using setup.py like any other distributed python module.

Building from the PyPi module file

The third is to obtain the PyPi-hosted module file, within which swig has been run; this saves running cmake and generating bindings. See HOWTO-RELEASE for how this is created. Because swig has been run, it need not be installed.

Installation via packaging systems

General

Many packaging systems (on GNU/Linux, various BSDs) provide the bindings as a package. Specific instruction are given in cases when that hint might not be sufficient.

pip

Due to the complex nature of GDAL and its components, different bindings may require additional packages and installation steps. GDAL can be installed from the Python Package Index:

pip install gdal

In order to enable numpy-based raster support, libgdal and its development headers must be installed as well as the Python packages numpy, setuptools, and wheel. To install the Python dependencies and build numpy-based raster support:

pip install numpy>1.0.0 wheel setuptools>=67
pip install gdal[numpy]=="$(gdal-config --version).*"

Users can verify that numpy-based raster support has been installed with:

python3 -c 'from osgeo import gdal_array'

If this command raises an ImportError, numpy-based raster support has not been properly installed:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.12/dist-packages/osgeo/gdal_array.py", line 10, in <module>
  from . import _gdal_array
ImportError: cannot import name '_gdal_array' from 'osgeo' (/usr/local/lib/python3.12/dist-packages/osgeo/__init__.py)

This is most often due to pip reusing a cached GDAL installation. Verify that the necessary dependencies have been installed and then run the following to force a clean build:

pip install --no-cache --force-reinstall gdal[numpy]=="$(gdal-config --version).*"

Potential issues with GDAL >= 3.9, Python >= 3.9 and NumPy 2.0 (pip)

The pyproject.toml file of GDAL 3.9 requires numpy >= 2.0.0rc1 (for Python >= 3.9) at build time to be able to build bindings that are compatible of both NumPy 1 and NumPy 2. If for some reason the numpy >= 2.0.0rc1 build dependency can not be installed, it is possible to manually install the build requirements, and invoke pip install with the --no-build-isolation flag.

pip install numpy==<required_version> wheel setuptools>=67
pip install gdal[numpy]=="$(gdal-config --version).*" --no-build-isolation

Conda

GDAL can be quite complex to build and install, particularly on Windows and MacOS. Pre built binaries are provided for the conda system:

https://docs.conda.io/

By the conda-forge project:

https://conda-forge.org/

Once you have Anaconda or Miniconda installed, you should be able to install GDAL with:

conda install -c conda-forge gdal

Usage

Imports

There are five major modules that are included with the GDAL Python bindings.:

>>> from osgeo import gdal
>>> from osgeo import ogr
>>> from osgeo import osr
>>> from osgeo import gdal_array
>>> from osgeo import gdalconst

API

Numpy

One advanced feature of the GDAL Python bindings not found in the other language bindings is integration with the Python numerical array facilities. The gdal.Dataset.ReadAsArray() method can be used to read raster data as numerical arrays, ready to use with the Python numerical array capabilities.

Tutorials

Gotchas

Although GDAL’s and OGR’s Python bindings provide a fairly “Pythonic” wrapper around the underlying C++ code, there are several ways in which the Python bindings differ from typical Python libraries. These differences can catch Python programmers by surprise and lead to unexpected results. These differences result from the complexity of developing a large, long-lived library while continuing to maintain backward compatibility. They are being addressed over time, but until they are all gone, please review this list of gotchas.

Examples

Performance Notes

  • ReadAsArray expects to make an entire copy of a raster band or dataset unless the data are explicitly subsetted as part of the function call. For large data, this approach is expected to be prohibitively memory intensive.

Metadata

Release files for gdal-wheel 3.13.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for gdal-wheel 3.13.3
File
gdal_wheel-3.13.3-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
gdal_wheel-3.13.3-cp314-cp314t-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Details
gdal_wheel-3.13.3-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
gdal_wheel-3.13.3-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
gdal_wheel-3.13.3-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details
gdal_wheel-3.13.3-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
gdal_wheel-3.13.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
gdal_wheel-3.13.3-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
gdal_wheel-3.13.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
gdal_wheel-3.13.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
gdal_wheel-3.13.3-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
gdal_wheel-3.13.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 269.2 MB

Release files / gdal_wheel-3.13.3-cp314-cp314t-win_amd64.whl

Download URL gdal_wheel-3.13.3-cp314-cp314t-win_amd64.whl
Size 19.5 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
1847940512205d05f7e1a5597bab3163bd969f35dbf45b83fd41cad753cdd2d0
BLAKE2b-256 checksum
How to use checksums
f0560069be2d4582aa0c974171f8ae104c271be72ebb00a562a8e96cd6b38350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp314-cp314t-manylinux_2_28_x86_64.whl

Download URL gdal_wheel-3.13.3-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 28.7 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0de55daec8622db85edd00353925a4f3c340745dab17eee20b59e7a148fd3c4a
BLAKE2b-256 checksum
How to use checksums
b77238fb522a2251cb30b0527879961b2e37fae356ed088d7dfaf1d4e30e085e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp314-cp314t-macosx_11_0_arm64.whl

Download URL gdal_wheel-3.13.3-cp314-cp314t-macosx_11_0_arm64.whl
Size 19.3 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9ccc27791463c16c121df5ca5f1cc8b494ed960f004f076ecf9276bf3c94f33a
BLAKE2b-256 checksum
How to use checksums
d1264f167fe8f913778a2f359ae7038dbf4b2e4c5cf99d1c105420c517d6d11a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp314-cp314-win_amd64.whl

Download URL gdal_wheel-3.13.3-cp314-cp314-win_amd64.whl
Size 19.5 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
0e2c9d70c1d2b58ebe774255c18fab08384552294d1f3010d70e40215fb834f0
BLAKE2b-256 checksum
How to use checksums
f26cbd2e50eddf479a005ddeb5d25a3a9e3b7a66184d37e615284dae9d4174d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL gdal_wheel-3.13.3-cp314-cp314-manylinux_2_28_x86_64.whl
Size 28.9 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6931c9bd9f8f4757c224c445d52772519748488462b3ebb62dbd9e2e7d8395a4
BLAKE2b-256 checksum
How to use checksums
7ff06f0a23917b2e2b7a16d64b6b09cc54de4be7e9ac81e93a2f267887b5a223
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp314-cp314-macosx_11_0_arm64.whl

Download URL gdal_wheel-3.13.3-cp314-cp314-macosx_11_0_arm64.whl
Size 19.3 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4a263db8e5a1bbc19088d6135696e4714a9b66ce510ecbce526b466035fb77b6
BLAKE2b-256 checksum
How to use checksums
d9ffc8965ab47b0b54a471e87ee416010240721939883613321508e4c7cac55f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp313-cp313-win_amd64.whl

Download URL gdal_wheel-3.13.3-cp313-cp313-win_amd64.whl
Size 18.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
aa7d098dbf7dc3c7a4128b1b56a7e5b202da5847ce405428383fdb8b37bfc84f
BLAKE2b-256 checksum
How to use checksums
8688790c225ea7938fadc99c6a6975a1834432974b5fdb30f726a8bbc7c6f6f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL gdal_wheel-3.13.3-cp313-cp313-manylinux_2_28_x86_64.whl
Size 28.9 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
15a6abbe25669cb186d5049f5ab7ad892b679caefb2100d79ce0cde625474116
BLAKE2b-256 checksum
How to use checksums
13723d8ec477600e43793976182f23a63af32f64e44f68eb154fff2dc8964347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL gdal_wheel-3.13.3-cp313-cp313-macosx_11_0_arm64.whl
Size 19.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9e2f2061496129b10496037eb3735e04efe6f371d3422ebbcc6d69ea2bfc1fbb
BLAKE2b-256 checksum
How to use checksums
5b75057c3ad40679aea40f6e04f3c6fe5b04b4d25b38690d4f377814d2ba275b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp312-cp312-win_amd64.whl

Download URL gdal_wheel-3.13.3-cp312-cp312-win_amd64.whl
Size 18.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e3b6e4cc90e15e66e3de6c0dfc4b8a78e55987944d74f6a186e4179305361430
BLAKE2b-256 checksum
How to use checksums
ebf5ddc81e58d84098ed3c4b1a4a654dd4b16135d853c422605541ae1488f321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL gdal_wheel-3.13.3-cp312-cp312-manylinux_2_28_x86_64.whl
Size 28.9 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6c0236b59c5d0dc5e106db2079cddd2482bce81a4d7924a9b0c2fa9179990858
BLAKE2b-256 checksum
How to use checksums
992b0cf3ed0612fde482dcdbc743243538c48fd53a9a2a3eab2162591d3dde4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / gdal_wheel-3.13.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL gdal_wheel-3.13.3-cp312-cp312-macosx_11_0_arm64.whl
Size 19.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4c6e045a9b36bea869d0656f7efb3edd65ef1e92d636632b6e17a386318dbe4b
BLAKE2b-256 checksum
How to use checksums
04521914b209fb7bd43a239fffc310d3ef2c24bca493870604441baf6ad7d581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.13.3 This release

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page