{"id":1055,"library":"zarr","title":"Zarr: Chunked, Compressed N-dimensional Arrays","description":"Zarr is a Python package that provides an implementation of chunked, compressed, N-dimensional arrays. It is designed for efficient use in parallel computing and supports various storage backends, including local disk, cloud object stores (like S3), and in-memory stores. The library is actively maintained, with its current version being 3.1.6, and recently underwent a significant refactor with the release of version 3, which introduced support for the Zarr v3 specification and improved performance.","status":"active","version":"3.1.6","language":"python","source_language":"en","source_url":"https://github.com/zarr-developers/zarr-python","tags":["data science","arrays","compression","cloud storage","n-dimensional","parallel computing","scientific computing"],"install":[{"cmd":"pip install zarr","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Essential for N-dimensional array operations, as Zarr arrays aim to be NumPy-like.","package":"numpy","optional":false},{"reason":"Provides a variety of compression and filtering codecs used by Zarr.","package":"numcodecs","optional":false},{"reason":"Enables reading and writing Zarr arrays to Amazon S3 (and compatible) object storage.","package":"s3fs","optional":true},{"reason":"Often used for higher-level data structures (Datasets, DataArrays) that utilize Zarr for backend storage, especially for scientific data.","package":"xarray","optional":true}],"imports":[{"symbol":"zarr","correct":"import zarr"},{"note":"Direct construction of `zarr.Array` is discouraged in Zarr-Python 3. Use `zarr.create_array` or `zarr.open_array` instead.","wrong":"from zarr import Array\nz = Array(...)","symbol":"zarr.create_array","correct":"import zarr\nz = zarr.create_array(...)"},{"note":"As of Zarr-Python 3.0, codecs like Blosc must be imported from `zarr.codecs` or directly from `numcodecs`, not from the top-level `zarr` module.","wrong":"from zarr import Blosc\ncompressors=Blosc(...)","symbol":"zarr.codecs.BloscCodec","correct":"import zarr.codecs\ncompressors=zarr.codecs.BloscCodec(...)"}],"quickstart":{"code":"import zarr\nimport numpy as np\nimport os\n\n# Create a directory for the Zarr store\nstore_path = 'data/example_zarr_array.zarr'\nos.makedirs(os.path.dirname(store_path), exist_ok=True)\n\n# Create a 2D Zarr array\n# This will default to Zarr format 3\nz_array = zarr.create_array(\n    store=store_path,\n    shape=(100, 100),\n    chunks=(10, 10),\n    dtype='f4'\n)\n\n# Assign data to the array\nz_array[:, :] = np.random.random((100, 100))\n\nprint(f\"Created Zarr array at: {store_path}\")\nprint(f\"Array info:\\n{z_array.info}\")\n\n# Access data\nsubset = z_array[0:5, 0:5]\nprint(f\"Subset of array:\\n{subset}\")\n\n# Clean up the created directory\nimport shutil\nshutil.rmtree('data')\n","lang":"python","description":"This quickstart demonstrates how to create a Zarr array, assign data to it using NumPy, and retrieve a subset. The array is stored on the local filesystem. This example defaults to Zarr format 3, which is the standard for Zarr-Python 3.x and newer."},"warnings":[{"fix":"Review the Zarr-Python 3.0 Migration Guide. Update codec imports (e.g., `from zarr.codecs import BloscCodec` or `from numcodecs import BloscCodec`). Use `zarr.create_array` or `zarr.open_array` for array creation.","message":"Zarr-Python 3.0 introduced significant breaking changes compared to 2.x, particularly a major refactor of the API, storage layer, and codec handling. Direct imports of codecs (e.g., `Blosc`) from `zarr.*` are no longer supported; they must be imported directly from `zarr.codecs` or `numcodecs`. Direct construction of `zarr.Array` is discouraged in favor of `zarr.create_array` or `zarr.open_array`.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If compatibility with Zarr format 2 is required, explicitly set `zarr_format=2` when creating new arrays, e.g., `zarr.create_array(..., zarr_format=2)`. Also, consider using `zarr.open_array` which can infer the format of existing stores.","message":"Newly created arrays in Zarr-Python 3.0 and later default to Zarr format 3. This means that arrays created without explicitly specifying a format will use the new V3 specification. This can cause compatibility issues with older Zarr consumers that only support Zarr format 2.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Be aware that consolidated metadata for Zarr v3 is a Zarr-Python-specific extension. If cross-implementation compatibility or strict adherence to the Zarr v3 spec is critical, consider avoiding consolidated metadata or managing metadata through other means. It is standard for Zarr-Python v2.","message":"Consolidated metadata is a feature in Zarr-Python that aggregates all metadata into a single file for faster access. However, for Zarr format 3, consolidated metadata is currently not part of the official specification. Its use may lead to compatibility issues with other Zarr implementations and its behavior might change in future Zarr-Python versions.","severity":"gotcha","affected_versions":"All Zarr-Python 3.x versions"},{"fix":"For optimal performance, especially in cloud environments, review the Zarr-Python documentation on asynchronous APIs and concurrency limits. Consider using `async` operations where applicable in your application design.","message":"Zarr-Python 3 introduces an asynchronous I/O architecture which significantly improves performance, especially with high-latency cloud stores. While a synchronous interface is provided, users with performance-critical cloud workloads may benefit from understanding and leveraging the async APIs.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Ensure that C/C++ build tools (e.g., `gcc`, `g++`) and Python development headers (e.g., `python3-dev` or `musl-dev` on Alpine) are installed in your environment before attempting to install Zarr or its dependencies.","message":"Installation of Zarr or its core dependency `numcodecs` may fail in minimal environments (like Alpine Linux) due to missing C/C++ build tools. `numcodecs` includes C extensions that require compilation during installation, and without a C compiler (e.g., `gcc`) and Python development headers, the build process will fail.","severity":"breaking","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-12T23:15:33.278Z","next_check":"2026-06-30T00:00:00.000Z","problems":[],"ecosystem":"pypi","meta_description":null,"install_score":50,"install_tag":"draft","quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.2.1","cli_name":"","cli_version":null,"install_checks":{"last_tested":"2026-05-12","tag":"draft","tag_description":"notable install failures or slow imports","installed_version":"2.18.2","pypi_latest":"3.2.1","is_stale":true,"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":4.5,"import_time_s":0.34,"mem_mb":12,"disk_size":"123M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.31,"mem_mb":12,"disk_size":"123M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4.3,"import_time_s":1.14,"mem_mb":19.1,"disk_size":"135M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":1.23,"mem_mb":19.1,"disk_size":"135M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4.2,"import_time_s":1.56,"mem_mb":19.3,"disk_size":"124M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":1.64,"mem_mb":19,"disk_size":"123M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4.2,"import_time_s":1.25,"mem_mb":19.5,"disk_size":"123M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":1.47,"mem_mb":18.8,"disk_size":"123M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"zarr","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":5.5,"import_time_s":0.39,"mem_mb":11.1,"disk_size":"128M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"zarr","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.43,"mem_mb":11.1,"disk_size":"128M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":null,"tag_description":null,"results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}