{"id":24349,"library":"pylerc","title":"pylerc","description":"Limited Error Raster Compression (LERC) library with Python bindings. Version 4.1 supports compression/decompression of rasters with a user-specified max error. Release cadence: approximately yearly, aligned with ArcGIS releases.","status":"active","version":"4.1.0","language":"python","source_language":"en","source_url":"https://github.com/Esri/lerc","tags":["raster","compression","lerc","esri","geospatial"],"install":[{"cmd":"pip install pylerc","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for array handling","package":"numpy","optional":false}],"imports":[{"note":"Lerc is a class inside the pylerc module, not a top-level module.","wrong":"import Lerc","symbol":"Lerc","correct":"from pylerc import Lerc"}],"quickstart":{"code":"import numpy as np\nfrom pylerc import Lerc\n\n# Create a sample 2D float array (height, width)\ndata = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32)\n\n# Encode with max error 0.1\nencoder = Lerc()\nencoded = encoder.encode(data, maxzerror=0.1)\nprint(f\"Encoded size: {len(encoded)} bytes\")\n\n# Decode back\ndecoded = encoder.decode(encoded)\nprint(\"Decoded array:\", decoded)","lang":"python","description":"Encode and decode a 2D float array with LERC compression."},"warnings":[{"fix":"pip uninstall lerc && pip install pylerc","message":"Package renamed from 'lerc' to 'pylerc' starting v4.1.0. 'pip install lerc' will install an older (pre-4.0) version. Uninstall old lerc package before installing pylerc.","severity":"breaking","affected_versions":">=4.1.0"},{"fix":"Change to Lerc().encode(data, maxzerror=0.1)","message":"The Lerc class API changed in v4.0.0: encode() now takes data as the first positional argument (previously took maxzerror first). Old code using Lerc().encode(maxzerror, data) will silently produce incorrect results or raise TypeError.","severity":"breaking","affected_versions":">=4.0.0,<5"},{"fix":"Create separate Lerc instances per thread or synchronize access.","message":"The Lerc class instance is stateful; do not use the same instance for concurrent encoding/decoding without locking. Reuse is safe sequentially.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use pip install pylerc","message":"Conda package is no longer updated for pylerc; only pip install is supported.","severity":"deprecated","affected_versions":">=4.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"pip install pylerc, then import pylerc","cause":"Package renamed to pylerc in v4.1. Importing 'lerc' refers to an older package or nothing.","error":"ModuleNotFoundError: No module named 'lerc'"},{"fix":"Call encode with keyword: Lerc().encode(data, maxzerror=0.1)","cause":"Using old positional argument order (maxzerror, data) with pylerc >=4.0.","error":"TypeError: Lerc.encode() got multiple values for argument 'data'"},{"fix":"Ensure input is the bytes object returned by encode() from the same or compatible version.","cause":"Trying to decode data that is not LERC-encoded or is corrupted.","error":"ValueError: Invalid LERC binary blob"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}