Skip to content

Unknown codec: 'zarr.codecs.numcodecs.PCodec' #3548

Closed

Description

@crisbodnar

Zarr version

v3.1.3

Numcodecs version

0.16.3

Python Version

3.12

Operating System

Linux

Installation

uv

Description

Using pcodec with zarr results in

zarr.errors.UnknownCodecError: Unknown codec: 'zarr.codecs.numcodecs.PCodec'

Steps to reproduce

import xarray as xr
import numpy as np
from numcodecs.zarr3 import PCodec

# Create a sample xarray dataset
data = np.random.rand(10, 20)
lat = np.arange(10)
lon = np.arange(20)
ds = xr.Dataset(
    {'my_variable': (('lat', 'lon'), data)},
    coords={'lat': lat, 'lon': lon}
)

# Define the pcodec compressor
compressor = PCodec()

# Specify the encoding for the data variables
encoding = {'my_variable': {'serializer': compressor}}

# Save the dataset to a zarr store
output_zarr_path = '/tmp/my_xarray_pcodec.zarr'

ds.to_zarr(output_zarr_path, mode='w', encoding=encoding, zarr_version=3)

Additional output

No response

Activity

  1. added
    bug
    on Oct 25, 2025
  2. d-v-b commented on Oct 27, 2026

    @d-v-b
    Contributor

    the zarr3 module is gone and pcodec should work as a normal numcodecs codec. closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions