Registry / data / lazrs
library0.8.1pypypiunverified

LAZrs provides Python bindings for `laz-rs`, a high-performance Rust implementation of LAZ (Laszip) compression and decompression. Its primary role is to serve as an optional, multi-threaded backend for other Python libraries, such as `laspy`, enabling them to efficiently read and write LAZ data. The library is currently at version 0.8.1, with releases tied to updates of its underlying Rust core.

pip install lazrs
INSTALL
IMPORT
SIG · LAZRS
L
lazrs
datapythonv0.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

LAZrs primarily functions as a high-performance backend for other libraries like `laspy`. This quickstart demonstrates how `laspy` leverages `lazrs` for transparent LAZ file compression and decompression. When `lazrs` is installed, `laspy` automatically uses it for LAZ processing, providing multi-threaded performance. There is no direct high-level API for `lazrs` for file operations; it's consumed implicitly by compatible libraries.

import laspy import os # Create a dummy LAS file for demonstration header = laspy.header.Header() header.point_format.scale = [0.01, 0.01, 0.01] header.point_format.offset = [0, 0, 0] points = laspy.create_points(point_count=100) points.x = range(100) points.y = range(100) points.z = range(100) input_filename = 'dummy.las' output_filename = 'compressed.laz' with laspy.open(input_filename, mode='w', header=header) as writer: writer.write_points(points) print(f"Created {input_filename} with {points.x.shape[0]} points.") # --- Using lazrs as a backend via laspy to compress and decompress --- # laspy will automatically detect and use lazrs if installed. # Explicitly set laz_backend=laspy.compression.LazBackend.Lazrs if needed. # Compress to LAZ using lazrs (implicitly by laspy) with laspy.open(input_filename, mode='r') as infile: with laspy.open(output_filename, mode='w', header=infile.header) as outfile: outfile.write_points(infile.read_points()) print(f"Compressed to {output_filename} using lazrs backend.") # Decompress from LAZ using lazrs (implicitly by laspy) with laspy.open(output_filename, mode='r') as reader: decompressed_points = reader.read_points() print(f"Decompressed {decompressed_points.x.shape[0]} points from {output_filename}.") assert decompressed_points.x.shape[0] == points.x.shape[0] # Clean up dummy files os.remove(input_filename) os.remove(output_filename) print("Cleaned up dummy files.")
Debug
Known issues
gotchaLAZrs does not support points with waveforms. If your LAZ data includes waveform information, you will need to use an alternative backend like `laszip-python` (if available and compatible with your version of `laspy`) to ensure all data is correctly handled.
fix
Consider `laszip-python` as an alternative backend for `laspy` if waveform data is critical. Install `laspy` with `pip install laspy[laszip]`.
affects: All versions
gotchaLAZrs is primarily a low-level Rust-based compression engine and offers no direct high-level Python API for file reading or writing. It is consumed as a backend by libraries like `laspy`, meaning users interact with `lazrs` indirectly through the `laspy` API. Attempting to find high-level `lazrs.read()` or `lazrs.write()` functions will be unsuccessful.
fix
Use a higher-level library like `laspy` (installed with `laspy[lazrs]`) for reading and writing LAZ files. `lazrs` will be used automatically by `laspy` for performance.
affects: All versions
gotchaExplicit documentation on breaking changes between major versions (e.g., from 0.5.x to 0.8.x) specifically for the Python bindings is not readily available. While the underlying Rust library may have its own changelog, direct impact on the Python API for non-backend users is unclear.
fix
When upgrading, thoroughly test existing code. Consult the `laz-rs-python` GitHub repository's commit history for changes if unexpected behavior occurs.
affects: 0.x to 0.8.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'lazrs'
The `lazrs` library is not installed in the Python environment you are currently using, or there's a typo in the import statement.
fix
Ensure `lazrs` is installed using `pip install lazrs` and that you are running your script in the correct Python environment where it was installed.
ERROR: lazrs-0.8.1-cpXX-cpXXm-manylinux_Y_Z_x86_64.whl is not a supported wheel on this platform.
The pre-built binary wheel for `lazrs` is incompatible with your system's `glibc` version, Python version, or architecture, often occurring in specific Linux distributions or Docker environments.
fix
Try updating `pip` (`python -m pip install --upgrade pip`) or explicitly specifying an older `lazrs` version that might have compatible wheels for your platform. If pre-built wheels are consistently incompatible, you might need to compile `lazrs` from source by ensuring you have Rust and the necessary build tools installed, then running `pip install lazrs` which will attempt a source build.
LazrsError: failed to fill whole buffer
This error typically occurs during LAZ data decompression when `lazrs` encounters corrupted, malformed, or unexpected data within the .laz file, preventing it from filling the target buffer completely.
fix
Inspect the .laz file for corruption or non-standard formatting. If possible, try decompressing the file with another LAZ utility to verify its integrity. If the file is valid, consider reporting the issue to the `lazrs` (or `laspy` if used as a backend) developers with a sample of the problematic data.
pyo3_runtime.PanicException: range end index 18446744073709551615 out of range for slice of length 0.
This is a low-level Rust panic, exposed through PyO3 (used by `lazrs`), that specifically occurs when attempting to append data to an initially empty .laz file using `laspy` with `lazrs` as the backend.
fix
As a workaround, ensure the .laz file is not empty when you start appending. Write at least one dummy point during the initial file creation or ensure it contains some valid data before any append operations. The core issue would require a fix in the `lazrs` or `laspy` library.
Upgrade
Version history
0.8.1latest on PyPI · released Dec 21, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
lazrs — pip install lazrs · libregistry