Skip to content

Can't use numpy types for array shapes #3680

@joshua-gould

Description

@joshua-gould

Zarr version

3.1.5

Numcodecs version

0.16.5

Python Version

3.12

Operating System

Mac

Installation

pip

Description

In zarr 3, shapes can no longer be numpy int types. This used to work in zarr 2.

Steps to reproduce

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
#
# This script automatically imports the development branch of zarr to check for issues

import zarr
import numpy as np


a = np.ones(2, dtype=int)
zarr.create_array("test", shape=(int(a.max())), dtype=int)  # works
zarr.create_array("test2", shape=(a.max()),
                  dtype=int)  # TypeError: Expected an integer or an iterable of integers. Got 1 instead.

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions