Registry / data / laspy
library2.7.0pypypi✓ verified 27d ago

Laspy is a native Python library for reading, modifying, and creating ASPRS LAS and LAZ (compressed) LIDAR files, supporting specifications 1.0 through 1.5. It provides a Pythonic API via NumPy arrays for efficient point cloud data manipulation. The library is actively maintained with frequent releases, typically several times a year.

pip install laspy
INSTALL
IMPORT
SIG · LASPY
L
laspy
datapythonv2.7.0
Install
4.1s avg
Import
384ms
Disk
96MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.7.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
glibc
py 3.10
3/5 runs
✓ 4.12s
py 3.11
3/5 runs
✓ 3.88s
py 3.12
3/5 runs
✓ 3.72s
py 3.13
3/5 runs
✓ 3.84s
py 3.9
3/5 runs
✓ 4.74s
96MB installed
● package 96MB
Code
Verified usage

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

laspy
✓ import laspy
File
✓ laspy.read('file.las')
✗ from laspy.file import File; infile = File('file.las', mode='r')
The `laspy.file.File` class was removed in `laspy` 2.0.0 and replaced with `laspy.read()` which returns a `LasData` object.

This quickstart demonstrates how to create a simple LAS file from scratch, read an existing LAS file using `laspy.open()` and `LasData.read()`, access point data and header attributes, and filter points. It also shows how to write new or modified `LasData` objects to a new file. Note the distinction between scaled (lowercase) and raw (uppercase) dimension access.

import laspy import numpy as np import os # Create a dummy LAS file for demonstration header = laspy.LasHeader(point_format=3, version="1.4") header.offsets = np.array([0, 0, 0]) header.scales = np.array([0.01, 0.01, 0.01]) las_data = laspy.LasData(header) n_points = 100 las_data.x = np.random.rand(n_points) * 100 las_data.y = np.random.rand(n_points) * 100 las_data.z = np.random.rand(n_points) * 50 las_data.classification = np.random.randint(0, 5, n_points) output_filename = "output.las" las_data.write(output_filename) print(f"Created {output_filename} with {len(las_data.points)} points.") # Read a LAS/LAZ file try: with laspy.open(output_filename) as fh: print(f"Reading {fh.header.point_count} points from {output_filename}") las = fh.read() # Access point data (scaled and raw) print(f"X (scaled): {las.x[:5]}") # Scaled coordinates print(f"X (raw): {las.X[:5]}") # Raw integer coordinates print(f"Classification: {las.classification[:5]}") # Access header information print(f"LAS Version: {las.header.version}") print(f"Point Format ID: {las.header.point_format.id}") print(f"Offset: {las.header.offsets}") print(f"Scale: {las.header.scales}") # Filter points (e.g., classification == 2) ground_points = las.points[las.classification == 2] print(f"Number of ground points (classification=2): {len(ground_points)}") # Create a new LAS file with filtered points new_las = laspy.create(point_format=las.header.point_format, file_version=las.header.version) new_las.points = ground_points filtered_output_filename = "filtered_output.las" new_las.write(filtered_output_filename) print(f"Created {filtered_output_filename} with {len(new_las.points)} filtered points.") finally: # Clean up dummy files if os.path.exists(output_filename): os.remove(output_filename) if os.path.exists(filtered_output_filename): os.remove(filtered_output_filename)
Debug
Known issues
breakinglaspy 2.0.0 introduced a significant API overhaul. The `laspy.file.File` class and its `open()` method were replaced by `laspy.read()` and `laspy.open()` returning `LasData` objects or readers/writers. Direct `get_*`/`set_*` methods on file objects were removed. The LAZ backend shifted from `lazperf` to `laszip-python` bindings or `lazrs`. Python 2.7 support was dropped.
fix
Migrate code to use `laspy.read()` for loading files into `LasData` objects or `laspy.open()` for chunked I/O. Access point data directly via `las_data.x` or `las_data.X` and header via `las_data.header`. Refer to the migration guide for detailed changes.
affects: >=2.0.0
gotchaWhen accessing point dimensions, `laspy` differentiates between scaled float values (lowercase attributes like `las.x`, `las.y`, `las.z`) and raw integer values (uppercase attributes like `las.X`, `las.Y`, `las.Z`). While both support assignment, assigning to scaled dimensions can introduce rounding errors.
fix
Be mindful of which attribute (scaled or raw) you are accessing or modifying. For precise manipulation of raw values, use the uppercase attributes.
affects: >=2.0.0
gotchaThe command-line interface (CLI) is an optional feature and requires additional dependencies (`rich` and `typer`). It must be installed using the `[cli]` extra.
fix
Install with `pip install laspy[cli]` to enable CLI commands like `laspy info`, `laspy compress`, `laspy decompress`, `laspy convert`, and `laspy copc query`.
affects: >=2.5.0
breakingSupport for LAS 1.5 specification and Python 3.14 was added in version 2.7.0. Users relying on LAZ compression/decompression for these new features will need to ensure `laszip-python` and/or `lazrs` are updated to compatible versions.
fix
Upgrade `laszip-python` and `lazrs` packages alongside `laspy` to their latest versions to ensure compatibility with LAS 1.5 and Python 3.14.
affects: >=2.7.0
gotchaWhen creating a new LAS file from scratch, it is crucial to properly initialize the `LasHeader` with appropriate `offsets` and `scales`. If not specified, default values may not be suitable for your data, or some software might not read the file correctly.
fix
Always explicitly set `header.offsets` and `header.scales` when creating a new `LasHeader` for a new file. These values define how raw integer coordinates are converted to scaled float coordinates.
affects: >=2.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'laspy'
The 'laspy' library is not installed in the Python environment you are currently using.
fix
Install the library using pip: `pip install laspy`
laspy.errors.LaspyException: No LazBackend selected, cannot decompress data.
You are attempting to read a compressed LAZ file without having a LAZ backend (like `lazrs` or `laszip`) installed alongside laspy.
fix
Install laspy with a LAZ backend. For example: `pip install 'laspy[lazrs]'` or `pip install 'laspy[laszip]'` (or both with `pip install 'laspy[lazrs,laszip]'`).
AttributeError: module 'laspy' has no attribute 'read'
This error occurs when using an outdated syntax to read LAS/LAZ files. In laspy 2.x, the `laspy.read()` function is used directly from the top-level module, replacing older methods like `laspy.file.File()` or `laspy.File()`.
fix
Use the modern `laspy.read()` function: `import laspy; las_data = laspy.read('your_file.las')`
AttributeError: 'numpy.ndarray' object has no attribute 'append'
You are trying to use a list's `append` method on a NumPy array, which does not have this method. This often happens when attempting to add points or dimensions to `laspy` data structures.
fix
When modifying point data, treat dimensions as NumPy arrays. To add new points, concatenate arrays or reassign the entire dimension. To add a new dimension, define it first in the point format, then assign a NumPy array of data. Example for adding a new dimension 'new_dim':
```python
import laspy
import numpy as np

# Assuming 'las' is an existing LasData object
# Define the new dimension (e.g., as an unsigned 8-bit integer)
las.add_extra_dims([laspy.ExtraBytesParams(name='new_dim', type=np.uint8)])

# Assign data to the new dimension
las.new_dim = np.zeros(len(las.points), dtype=np.uint8)
```
Upgrade
Version history
2.7.0latest on PyPI · released Jan 14, 2026
Audit
Dependencies
numpyrequiredCore dependency for array-based point data manipulation.
lazrsoptionalOptional backend for LAZ compression/decompression, generally faster due to multi-threading. Required for COPC support.
laszip-pythonoptionalOptional backend for LAZ compression/decompression, official implementation, supports waveform data.
pyprojoptionalOptional, for Coordinate Reference System (CRS) / Spatial Reference System (SRS) handling.
requestsoptionalOptional, enables CopcReader to handle COPC files from HTTP servers.
richoptionalRequired for the optional command-line interface (CLI) features.
typeroptionalRequired for the optional command-line interface (CLI) features.
Agent activity
14 hits · last 30 days
node
12
Resources
laspy — pip install laspy · libregistry