Registry / data / pyogrio

pyogrio

JSON →
library0.13.0pypypi✓ verified 27d ago

Pyogrio provides fast, bulk-oriented read and write access to GDAL/OGR vector data sources such as ESRI Shapefile, GeoPackage, GeoJSON, and FlatGeobuf. It significantly optimizes performance for geospatial data operations by leveraging pre-compiled GDAL/OGR bindings, thereby minimizing Python data type conversions. The library is actively maintained, with frequent releases that may include breaking changes between major minor versions. The current stable version is 0.12.1.

pip install pyogrio
INSTALL
IMPORT
SIG · PYOGRIO
P
pyogrio
datapythonv0.13.0
Install
4.6s avg
Import
350ms
Disk
187MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.6s · import 0.350s · 190MB
187MB installed
● package 187MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

read_dataframe
from pyogrio import read_dataframe
write_dataframe
from pyogrio import write_dataframe
list_drivers
from pyogrio import list_drivers
read_info
from pyogrio import read_info

This quickstart demonstrates how to create a basic GeoPandas GeoDataFrame, write it to a GeoPackage file using `pyogrio.write_dataframe`, and then read the data back into a GeoDataFrame using `pyogrio.read_dataframe`.

import geopandas as gpd from pyogrio import read_dataframe, write_dataframe from shapely.geometry import Point import os # Create a dummy GeoDataFrame data = {'name': ['Location A', 'Location B'], 'value': [10, 20]} geometry = [Point(1, 1), Point(2, 2)] gdf = gpd.GeoDataFrame(data, geometry=geometry, crs="EPSG:4326") # Define output path output_file = "my_geodata.gpkg" # Write GeoDataFrame to a GeoPackage file print(f"Writing data to {output_file}...") write_dataframe(gdf, output_file, driver="GPKG", layer="my_points") print("Write complete.") # Read GeoDataFrame from the GeoPackage file print(f"Reading data from {output_file}...") read_gdf = read_dataframe(output_file, layer="my_points") print("Read complete.") print(read_gdf) # Clean up the created file # os.remove(output_file) # print(f"Cleaned up {output_file}.")
Debug
Known issues
breakingIn version 0.12.0, the `read_dataframe` function started returning JSON fields as Python `dict`s or `list`s, whereas they were previously returned as raw strings. This change affects how JSON-type columns are handled programmatically.
fix
Update your code to expect `dict` or `list` types for JSON columns read from data sources.
affects: >=0.12.0
breakingAs of version 0.12.0, Pyogrio dropped official support for GDAL versions 3.4 and 3.5. Users are now required to use GDAL 3.6 or newer.
fix
Ensure your environment has GDAL 3.6 or a newer compatible version installed. Conda-forge installations typically handle this dependency.
affects: >=0.12.0
gotchaPyogrio's binary wheels often bundle a specific GDAL version, which might conflict with a system-installed GDAL or one linked by other geospatial libraries like Fiona. This can lead to `DriverError` or `NullPointerError`.
fix
Check the GDAL version Pyogrio is using via `pyogrio.__gdal_version_string__`. If conflicts arise, consider uninstalling then reinstalling Fiona with `--no-binary fiona` (e.g., `pip uninstall fiona; pip install fiona --no-binary fiona`) or use a conda-forge environment for consistent GDAL versions.
affects: All versions
gotchaIn `read_dataframe`, datetime columns with mixed time zone offsets are converted to UTC by default. This might alter original offset information if not explicitly handled.
fix
To retain original offsets or convert datetimes to strings, use the `datetime_as_string=True` or `mixed_offsets_as_utc=False` parameters in `read_dataframe`.
affects: >=0.12.0
gotchaMacOS binary wheels for Pyogrio are built specifically for macOS 12 and newer. Users on older macOS versions (e.g., macOS 11 or earlier) will need to build Pyogrio from source, which requires a pre-installed GDAL development environment.
fix
Upgrade macOS to version 12+ or follow the instructions for building Pyogrio from source if on an older OS.
affects: >=0.9.0
gotchaUtilizing the `use_arrow=True` option in `read_dataframe` or `write_dataframe` for performance benefits requires the `pyarrow` library to be installed. Additionally, writing with Arrow (`use_arrow=True` in `write_dataframe`) specifically requires GDAL >= 3.8, while reading with Arrow requires GDAL >= 3.6.
fix
Install `pyarrow` (`pip install pyarrow`) and ensure your GDAL version meets the minimum requirements (3.6 for reading, 3.8 for writing).
affects: All versions
gotchaPyogrio does not perform validation of attribute values or geometry types before attempting to write data to an output file. Providing invalid types may result in crashes during the write operation with cryptic error messages.
fix
Ensure that the data types in your GeoDataFrame columns are compatible with the target OGR driver's schema before writing. Convert incompatible types (e.g., lists, tuples) to supported formats (e.g., strings) if necessary.
affects: All versions
gotchaMany common usages and examples of Pyogrio, especially when working with GeoDataFrames, implicitly rely on the `geopandas` library. If `geopandas` is not installed, scripts attempting to import or use it will raise a `ModuleNotFoundError`.
fix
Install `geopandas` using `pip install geopandas` or via your package manager (e.g., `conda install geopandas -c conda-forge`).
affects: All versions
breakingWhen installing Pyogrio without pre-built binary wheels (e.g., on minimal environments like Alpine, newer Python versions, or specific architectures), the GDAL development libraries (including `gdal-config`) must be installed in the environment for successful compilation.
fix
Install GDAL development libraries and headers appropriate for your operating system. For Alpine, use `apk add gdal-dev`. For Debian/Ubuntu, use `apt install libgdal-dev`. For Conda environments, use `conda install gdal`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyogrio._io'
This error occurs when the compiled C extensions of pyogrio, which depend on the GDAL/OGR library, fail to build or load, usually because GDAL development headers or shared libraries are not found on the system during installation.
fix
Ensure GDAL/OGR and its development libraries are installed on your system before installing pyogrio. For Debian/Ubuntu: `sudo apt-get update && sudo apt-get install libgdal-dev gdal-bin`. For Conda: `conda install -c conda-forge pyogrio gdal`.
OGRError: Failed to open dataset "/path/to/your_file.shp" for reading.
The specified geospatial data file could not be found, the path provided is incorrect, or the program lacks the necessary permissions to access the file or its containing directory.
fix
Verify that the file path is correct, the file exists at that location, and that your program has read permissions for both the file and the directory.
OGRError: Driver 'ESRI Shapefile' does not support multiple layers.
The ESRI Shapefile format is designed to store only a single layer of geographic features per file, so attempting to write multiple layers to a single .shp file will fail.
fix
When writing to a Shapefile, ensure your GeoDataFrame contains only one layer. For multi-layer data, use a format that supports it, such as GeoPackage (`.gpkg`), FlatGeobuf (`.fgb`), or create separate Shapefiles for each layer.
OGRError: Could not convert geometry to WKB.
This error arises during a write operation when the geometry column of a GeoDataFrame contains objects that are either not valid shapely geometry objects or cannot be successfully converted into a Well-Known Binary (WKB) format by GDAL/OGR.
fix
Validate and clean your geometries before writing; ensure all entries in the geometry column are valid shapely objects, e.g., `df.geometry = df.geometry.apply(lambda geom: geom.buffer(0) if geom and not geom.is_valid else geom)` or `df.geometry = shapely.make_valid(df.geometry)`.
Upgrade
Version history
0.13.0latest on PyPI · released Jun 26, 2026
Audit
Dependencies
pythonrequiredRequired Python version.
GDAL/OGRrequiredCore underlying C/C++ library for spatial vector file I/O. Often bundled with Pyogrio wheels or managed by conda-forge.
geopandasrequiredFor reading and writing GeoDataFrames, which is the typical use case.
shapelyrequiredRequired by GeoPandas for geometry operations.
pyarrowoptionalOptional dependency for significantly faster I/O when `use_arrow=True` is specified.
Agent activity
17 hits · last 30 days
node
16
Resources
pyogrio — pip install pyogrio · libregistry