Install & Compatibility
Where this runs
tested against v0.7.6 · 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
py 3.12
✕ build_error
✕ build_error
py 3.13
✕ build_error
✕ build_error
317MB installed
● package 317MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Meshes
✓ from pytorch3d.structures import Meshes
✗ from pytorch3d.structures import Meshes
This quickstart example demonstrates how to create two isometric sphere meshes, sample points from their surfaces, and compute the Chamfer distance between the sampled point clouds using PyTorch3D's utility functions and loss modules. This is a common operation in 3D shape comparison and optimization. Ensure you have a compatible PyTorch installation.
import torch
from pytorch3d.utils import ico_sphere
from pytorch3d.ops import sample_points_from_meshes
from pytorch3d.loss import chamfer_distance
# Set device
if torch.cuda.is_available():
device = torch.device("cuda:0")
else:
device = torch.device("cpu")
# Create two ico_sphere meshes with different levels of detail
sphere_mesh_1 = ico_sphere(level=3, device=device)
sphere_mesh_2 = ico_sphere(level=4, device=device)
# Differentiably sample 5k points from the surface of each mesh
sample_points_1 = sample_points_from_meshes(sphere_mesh_1, 5000)
sample_points_2 = sample_points_from_meshes(sphere_mesh_2, 5000)
# Compute the Chamfer distance between the two sets of points
loss_chamfer, _ = chamfer_distance(sample_points_1, sample_points_2)
print(f"Chamfer Distance: {loss_chamfer.item():.4f}")
Debug
Known issues
breakingPyTorch3D does not guarantee backward-compatibility between releases. Best efforts are made to communicate breaking changes and facilitate code migration, but users should review release notes for significant version bumps.fixAlways check the official release notes and migration guides when upgrading, particularly for changes in API signatures or module locations.
affects: All versions, especially major/minor releases (e.g., v0.7.0, v0.4.0).
gotchaThe differentiable renderer API in PyTorch3D is marked as experimental and subject to change. Applications relying heavily on specific renderer configurations might require updates in future versions.fixMonitor PyTorch3D updates related to the renderer for potential breaking changes. Abstract renderer setup in your code if possible to minimize impact.
affects: All versions, as long as the API is experimental.
gotchaPyTorch3D uses different coordinate system conventions compared to OpenGL (e.g., +Z direction). This can lead to unexpected rendering results or model transformations if not accounted for.fixCarefully review the PyTorch3D documentation on coordinate transformation conventions, especially when integrating with other 3D libraries or data sources. Transformations might be necessary.
affects: All versions.
gotchaPyTorch3D has strict compatibility requirements with its underlying PyTorch version. Installing `pipablepytorch3d` does not automatically guarantee a compatible PyTorch version, which can lead to runtime errors or installation failures.fixBefore installing `pipablepytorch3d`, ensure your PyTorch version (and CUDA if applicable) matches the recommended range for the specific PyTorch3D version. Consult the official PyTorch3D GitHub or documentation for the precise compatibility matrix. `pip install torch==X.Y.Z torchvision==X.Y.Z torchaudio==X.Y.Z --index-url ...` should be run *before* `pip install pipablepytorch3d`.
affects: All versions. For example, PyTorch3D v0.7.5 supports PyTorch 1.9.0 to 1.13.0, and deprecates Python 3.7.
Upgrade
Version history
0.7.6latest on PyPI · released Jul 9, 2024
Audit
Dependencies
torchrequiredPyTorch3D is built on PyTorch tensors and requires a compatible PyTorch installation. Ensure your PyTorch version is compatible with PyTorch3D 0.7.x (e.g., PyTorch 1.9.0 to 1.13.0 for PyTorch3D v0.7.5).