tetgen
Python interface to tetgen
What it is and what it does
tetgen is a Python wrapper around the TetGen C++ software for generating tetrahedral meshes of 3D polyhedral domains. It combines the speed of compiled C++ with Python's ease of use. The underlying TetGen engine (version 1.6.0) produces exact constrained Delaunay tetrahedralizations, boundary-conforming Delaunay meshes, and Voronoi partitions—all suitable for numerical methods like finite element or finite volume analysis.
Typical workflows involve passing a triangular surface mesh to tetgen, specifying quality constraints (dihedral angles, aspect ratios), and optionally using a background mesh to define spatially varying element sizes for adaptive refinement. The result is a tetrahedral grid that can be analyzed or exported for downstream simulation. The package supports Python 3.10 through 3.14 and depends only on numpy.
Use it for:
- Generate tetrahedral meshes from surface geometries for finite element simulations in structural mechanics or fluid dynamics.
- Create adaptive meshes with finer elements near regions of interest using background mesh sizing functions.
- Produce Voronoi partitions for spatial analysis or computational geometry tasks.
- Refine existing meshes to meet quality constraints (minimum dihedral angles, aspect ratios) for numerical stability.
- Process manifold triangular surfaces into tetrahedral grids for numerical analysis workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
tetgen wraps the TetGen C++ library to generate tetrahedral meshes from 3D polyhedral domains, producing constrained Delaunay tetrahedralizations and Voronoi partitions suitable for finite element and finite volume methods.
Yes, if you need tetrahedral mesh generation for scientific computing. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and offers pre-built wheels that minimize installation friction. The single runtime dependency (numpy) is standard. Install only if you actually work with 3D mesh generation; it is not a general-purpose utility.
Install
tetgen on PyPI
pip
pip install tetgenuv
uv add tetgenpoetry
poetry add tetgenInstalling tetgen
Before you install
Medium install friction due to compiled C++ bindings, but mitigated by pre-built wheels for Python 3.10–3.14 across macOS (Intel and ARM), Linux (x86_64 and aarch64), and Windows. Actively maintained with recent releases and no known vulnerabilities.
License in practice
MIT license permits commercial and private use with minimal restrictions; attribution required but no copyleft obligations.
Quickstart
pip install tetgen
import tetgen
import numpy as np
tet = tetgen.TetGen(surface_mesh)
tet.tetrahedralize(order=1, mindihedral=20, minratio=1.5)
grid = tet.grid
Requires Python 3.10 or later; numpy is a runtime dependency.
Verify before relying
- Whether background mesh sizing functions support arbitrary user-defined criteria beyond proximity-based refinement.
- Performance characteristics and scalability limits for very large or complex polyhedral domains.
- Availability of detailed error handling and diagnostic output when mesh generation fails.
- Integration capabilities with visualization tools beyond what the fact sheet explicitly states.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 102 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 105,840/month — #12,676 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tetgen-0.8.4-cp310-cp310-macosx_10_14_x86_64.whl; tetgen-0.8.4-cp310-cp310-macosx_11_0_arm64.whl; tetgen-0.8.4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; tetgen-0.8.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tetgen-0.8.4-cp310-cp310-win_amd64.whl; tetgen-0.8.4-cp311-cp311-macosx_10_14_x86_64.whl; tetgen-0.8.4-cp311-cp311-macosx_11_0_arm64.whl; tetgen-0.8.4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; tetgen-0.8.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tetgen-0.8.4-cp311-cp311-win_amd64.whl; tetgen-0.8.4-cp312-abi3-macosx_10_14_x86_64.whl; tetgen-0.8.4-cp312-abi3-macosx_11_0_arm64.whl; tetgen-0.8.4-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; tetgen-0.8.4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; tetgen-0.8.4-cp312-abi3-win_amd64.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
cytriangleCyTriangle wraps Jonathan Shewchuk's Triangle…
copyleft · top 15,000 on PyPI
pytetwildpytetwild converts surface meshes into…
copyleft · top 15,000 on PyPI
scikit-femTransforms bilinear and linear forms into…
permissive · top 15,000 on PyPI
triangleTriangle wraps Jonathan Richard Shewchuk's C…
copyleft · top 15,000 on PyPI
fast-simplificationSimplifies 3D meshes by reducing the number of…
permissive · top 15,000 on PyPI
gmshGmsh is a three-dimensional finite element mesh…
copyleft · top 15,000 on PyPI
manifold3dManifold3d creates and operates on manifold…
permissive · top 5,000 on PyPI
PyGEL3DPyGEL3D provides Python bindings for a C++…
permissive · top 15,000 on PyPI
tesseractComputes dark matter halo concentration…
copyleft · top 15,000 on PyPI
cmeel-qhullProvides precompiled qhull binaries (convex…
unclear · top 15,000 on PyPI