Install & Compatibility
Where this runs
tested against v1.14.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
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 6.8s · import 0.368s · 252MB
254MB installed
● package 254MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
pymongoarrow
✓ import pymongoarrow
pymongoarrow.api
✓ from pymongoarrow.api import Schema
Basic usage: patch pymongo, define schema, query collections to get Arrow/Pandas/Polars outputs.
import os
import pymongo
from pymongoarrow.api import Schema
from pymongoarrow.monkey import patch_all
# Patch pymongo to enable arrow operations
patch_all()
client = pymongo.MongoClient(os.environ.get('MONGODB_URI', 'mongodb://localhost:27017'))
db = client.test
coll = db.mydata
# Define schema (field name: type)
schema = Schema({'name': str, 'age': int, 'city': str})
# Insert sample data
coll.insert_many([
{'name': 'Alice', 'age': 30, 'city': 'NYC'},
{'name': 'Bob', 'age': 25, 'city': 'SF'},
])
# Fetch as Arrow table
import pyarrow as pa
table = coll.find_arrow_all({}, schema=schema)
print(table)
# Convert to pandas
df = coll.find_pandas_all({}, schema=schema)
print(df)
# Convert to polars
import polars as pl
pl_df = coll.find_polars_all({}, schema=schema)
print(pl_df)
Errors
Common errors & fixes
ImportError: cannot import name 'patch_all' from 'pymongoarrow'
Import path changed in older versions; patch_all is in pymongoarrow.monkey.
fixUse: from pymongoarrow.monkey import patch_all
TypeError: 'Schema' object is not callable
Schema is not a function; it's a class that takes keyword arguments.
fixUse: Schema({'field': type}) instead of Schema('field', type) pymongo.errors.OperationFailure: unknown command: aggregation
MongoDB server version too old (<3.6) or missing aggregation support.
fixUpgrade MongoDB to >=3.6 or use a different query method.
Upgrade
Version history
1.14.0latest on PyPI · released May 28, 2026
Audit
Dependencies
pymongorequiredMongoDB driver
pyarrowrequiredArrow data format
pandasoptionalDataFrame conversion
polarsoptionalDataFrame conversion