Skip to content

write_netcdf fails with pandas 3 for assemblies with string coordinates #242

Done

Description

@albertlieyingadrian

brainscore_core declares pandas without an upper bound, while vision and language both pin pandas<3. Installing core on its own now pulls pandas 3, and with the pinned xarray<2022.6 that breaks writing assemblies that have string coordinates:

import numpy as np, os, tempfile
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly
from brainscore_core.supported_data_standards.brainio.packaging import write_netcdf

a = NeuroidAssembly(np.zeros((2, 2)),
                    coords={"stimulus_id": ("presentation", ["a", "b"]),
                            "neuroid_id": ("neuroid", ["n0", "n1"])},
                    dims=["presentation", "neuroid"])
write_netcdf(a, os.path.join(tempfile.mkdtemp(), "x.nc"))
  • pandas 3.0.6, xarray 2022.3.0, netCDF4 1.7.5.1, numpy 1.26.4 (a fresh pip install brainscore_core): ValueError: unsupported dtype for netCDF4 variable: object
  • The same environment with pandas 2.3.3: writes fine.

So package_data_assembly fails for typical assemblies (string stimulus_id/neuroid_id) when core is used without vision or language. Pinning pandas<3 in core, as the domain repos do, would avoid it until xarray can be upgraded.

Activity

  1. albertlieyingadrian commented on Nov 13, 2026

    @albertlieyingadrian
    ContributorAuthor

    The repo's own brainio/tests/test_packaging.py::test_write_netcdf (and test_package_data_assembly, test_package_extras, test_compression) fails the same way in a fresh env with pandas 3.0.6, and passes after pip install 'pandas<3'. CI doesn't see it because the Jenkins env has pandas 2.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions