Registry / data / pykdtree

pykdtree

JSON →
library1.4.3pypypi✓ verified 87d ago

A fast kd-tree implementation in Cython with OpenMP-enabled parallel queries. Current version 1.4.3, supports Python >=3.9 and NumPy >=1.25. Release cadence is irregular, with several maintenance releases addressing bugs and build compatibility.

pip install pykdtree
INSTALL
IMPORT
SIG · PYKDTREE
P
pykdtree
datapythonv1.4.3
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4.3 · 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
glibc
py 3.10
1/2 runs
1/2 runs
py 3.11
1/2 runs
1/2 runs
py 3.12
1/2 runs
1/2 runs
py 3.13
1/2 runs
1/2 runs
py 3.9
1/2 runs
1/2 runs
Code
Verified usage

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

KDTree
from pykdtree.kdtree import KDTree
Direct import from kdtree submodule.

Create a KDTree from 100 random 3D points and query nearest 4 neighbors for 5 new points.

import numpy as np from pykdtree.kdtree import KDTree data = np.random.randn(100, 3) tree = KDTree(data) query = np.random.randn(5, 3) dists, idx = tree.query(query, k=4) print(dists, idx)
Debug
Known issues
gotchaInput data must be a 2D NumPy array with dtype float64 or float32. If using float32, queries disable OpenMP parallelization.
fix
Ensure data is np.float64 or np.float32, and for large data prefer float64 to benefit from OpenMP.
affects: all
breakingVersion 1.4.0 changed internal integer sizes to handle large arrays. Trees built with older versions cannot be pickled and loaded in 1.4.0+.
fix
Rebuild trees after upgrading pykdtree.
affects: 1.4.0 and later
deprecatedImporting KDTree directly from pykdtree (e.g., from pykdtree import KDTree) is no longer supported as of 1.4.0.
fix
Use from pykdtree.kdtree import KDTree instead.
affects: >=1.4.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pykdtree.kdtree'
Import path changed; users try from pykdtree import KDTree.
fix
Use: from pykdtree.kdtree import KDTree
pykdtree.kdtree.KDTree not returning correct results for large arrays
Integer overflow in tree indexing before version 1.4.0.
fix
Upgrade to pykdtree >= 1.4.0.
Segmentation fault (core dumped) when querying empty array
Bug in versions < 1.3.13 when input data has zero rows.
fix
Upgrade to pykdtree >= 1.3.13.
Upgrade
Version history
1.4.3latest on PyPI · released Aug 6, 2025
Audit
Dependencies
numpyrequiredCore dependency for array handling and API compatibility.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
pykdtree — pip install pykdtree · libregistry