Registry / data / trimesh

trimesh

JSON →
library5.0.0pypypi✓ verified 28d ago

Trimesh is a Python library for loading, viewing, processing, and analyzing triangular meshes, with a strong emphasis on vectorized operations for performance. It's actively developed and frequently updated, providing a comprehensive set of tools for 3D geometry manipulation.

pip install trimesh
INSTALL
IMPORT
SIG · TRIMESH
T
trimesh
datapythonv5.0.0
Install
4.0s avg
Import
550ms
Disk
93MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v5.0.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.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.554s · 93.2MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 4.0s · import 0.546s · 89MB
93MB installed
● package 93MB
Code
Verified usage

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

Trimesh
✓ from trimesh import Trimesh
✗ import trimesh
Scene
✓ from trimesh import Scene
PointCloud
✓ from trimesh import PointCloud

This quickstart demonstrates creating a basic mesh, performing common analyses like volume and area calculation, and loading a mesh from a remote URL. It focuses on core functionality that doesn't require interactive display.

import trimesh import numpy as np # 1. Create a simple mesh (a box) mesh = trimesh.creation.box() # 2. Perform basic analyses volume = mesh.volume area = mesh.area inertia = mesh.moment_inertia print(f"Mesh volume: {volume:.2f}") print(f"Mesh surface area: {area:.2f}") print(f"Mesh moment of inertia:\n{inertia}") # 3. Load a remote mesh (requires network access) try: # Using a known stable URL for demonstration mesh_loaded = trimesh.load_remote('https://raw.githubusercontent.com/mikedh/trimesh/main/models/feature.stl') print(f"Loaded remote mesh, volume: {mesh_loaded.volume:.2f}") except Exception as e: print(f"Could not load remote mesh: {e}. Check internet connection or URL.")
Debug
Known issues
gotchaTrimesh has many optional dependencies for different features (e.g., `scipy` for algorithms, `pyrender` for visualization, `lxml` for file formats, `rtree` for spatial queries). Missing dependencies lead to `AttributeError` or `ModuleNotFoundError` when trying to use those features.
fix
Install `trimesh[full]` to get most common optional dependencies, or install specific packages as needed (e.g., `pip install trimesh scipy pyrender`). Consult the official documentation for feature-specific dependencies.
affects: All versions
breakingThe `trimesh.visual` module and visualization backend configuration have seen significant API changes and refactors, particularly around versions 3.x and 4.x. Old visualization code, especially custom `ColorVisuals` or direct `viewer` interaction, may break.
fix
Consult the `trimesh` documentation for your specific version regarding visualization. For robust rendering, consider using `pyrender` directly or `open3d` integration rather than `trimesh.show()` which relies on `pyglet`.
affects: >=3.0, >=4.0
gotchaThe `trimesh.show()` function relies on `pyglet` and an active OpenGL context, which often fails in headless environments (e.g., CI/CD, cloud instances, WSL without display server) or systems with non-standard display drivers, resulting in a blank window or errors.
fix
For headless visualization, use `pyrender` or `open3d` which support offscreen rendering, or export your mesh to a common file format (e.g., OBJ, STL). For interactive use, ensure `pyglet` is installed and your environment has a working OpenGL display server.
affects: All versions
Upgrade
Version history
5.0.0latest on PyPI · released Aug 1, 2026
Audit
Dependencies
scipyoptionalRequired for many advanced mesh operations (e.g., convex hulls, path planning, distance calculations).
pyrenderoptionalRecommended for robust and offscreen 3D visualization, especially in headless environments.
lxmloptionalRequired for importing/exporting some XML-based formats like DAE and SVG.
Agent activity
43 hits · last 30 days
node
40
OpenAI (training)
1
Resources
trimesh — pip install trimesh · libregistry