zarr-developers / zarr-python

An implementation of chunked, compressed, N-dimensional arrays for Python.
https://zarr.readthedocs.io
MIT License
1.45k stars 273 forks source link

AttributeError: 'Tree' object has no attribute '_repr_mimebundle_' #1664

Closed jwrth closed 7 months ago

jwrth commented 7 months ago

Zarr version

0.16.1

Numcodecs version

0.11.0

Python Version

3.9

Operating System

Windows

Installation

using pip into conda environment

Description

Hi, I am getting following error after loading a zarr container with z = zarr.open(...) and calling z.tree():

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File c:\Users\...\AppData\Local\miniconda3\envs\insitupy\lib\site-packages\IPython\core\formatters.py:974, in MimeBundleFormatter.__call__(self, obj, include, exclude)
    971     method = get_real_method(obj, self.print_method)
    973     if method is not None:
--> 974         return method(include=include, exclude=exclude)
    975     return None
    976 else:

File c:\Users\...\AppData\Local\miniconda3\envs\insitupy\lib\site-packages\zarr\util.py:552, in TreeViewer._repr_mimebundle_(self, **kwargs)
    550 def _repr_mimebundle_(self, **kwargs):
    551     tree = tree_widget(self.group, expand=self.expand, level=self.level)
--> 552     return tree._repr_mimebundle_(**kwargs)

AttributeError: 'Tree' object has no attribute '_repr_mimebundle_'

After the error, the tree is printed out like this instead of the interactive mode:

/
 ├── cell_id (58264, 2) uint32
 ├── cell_summary (58264, 7) float64
 ├── masks
 │   ├── 0 (20539, 28483) uint32
 │   ├── 1 (20539, 28483) uint32
 │   └── homogeneous_transform (4, 4) float32
 ├── polygon_num_vertices (2, 58264) int32
 ├── polygon_vertices (2, 58264, 26) float32
 └── seg_mask_value (58264,) uint32

Steps to reproduce

z = zarr.open("path/to/zarr/")
z.tree()

I do not really have a reproducible code and think it has more to do with the package dependencies. Let me know if you know a way how I can give you a more reproducible code example.

Thanks a lot in advance!

Additional output

This is my pip freeze:

aiobotocore==2.5.4
aiohttp==3.8.5
aioitertools==0.11.0
aiosignal==1.3.1
alabaster==0.7.16
anndata==0.10.5.post1
annotated-types==0.6.0
annoy @ file:///C:/Users/ge37voy/Github/InSituPy/wheels/annoy-1.17.0-cp39-cp39-win_amd64.whl#sha256=df1c8606fea2af9b77f2999fae4973d8554fe6f4fa011295ea884e3b32a67b32
anyio==4.2.0
app-model==0.2.4
appdirs==1.4.4
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
array_api_compat==1.4.1
arrow==1.3.0
asciitree==0.3.3
asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1698341106958/work
async-lru==2.0.4
async-timeout==4.0.3
attrs==23.2.0
Babel==2.14.0
beautifulsoup4==4.12.3
bleach==6.1.0
bokeh==3.3.4
botocore==1.31.17
build==1.0.3
cachey==0.2.1
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==3.0.0
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work
colorcet==3.0.1
comm @ file:///home/conda/feedstock_root/build_artifacts/comm_1704278392174/work
contourpy==1.2.0
cramjam==2.8.1
cycler==0.12.1
dask==2023.12.1
dask-image==2023.8.1
datashader==0.15.2
datashape==0.5.2
debugpy @ file:///D:/bld/debugpy_1707444604970/work
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1641555617451/work
defusedxml==0.7.1
docstring-parser==0.15
docutils==0.20.1
entrypoints==0.4
et-xmlfile==1.1.0
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1704921103267/work
executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1698579936712/work
fasteners==0.19
fastjsonschema==2.19.1
fastparquet==2023.10.1
fbpca==1.0
fcsparser==0.2.4
fiona==1.9.5
fonttools==4.48.1
fqdn==1.5.1
freetype-py==2.4.0
frozenlist==1.4.0
fsspec==2024.2.0
geopandas==0.14.3
geosketch==1.2
get-annotations==0.1.2
h11==0.14.0
h5py==3.10.0
HeapDict==1.0.1
hsluv==5.0.4
httpcore==1.0.2
httpx==0.26.0
idna==3.6
igraph==0.11.3
imagecodecs==2023.9.18
imageio==2.33.1
imagesize==1.4.1
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1703269254275/work
importlib-resources==6.1.1
in-n-out==0.1.9
iniconfig==2.0.0
-e git+https://github.com/jwrth/InSituPy.git@3637b5ffa0b87d5f1bdc151ffbaf693c7c806fa2#egg=insitupy
intervaltree==3.1.0
ipykernel @ file:///D:/bld/ipykernel_1707326433944/work
ipython @ file:///D:/bld/ipython_1701831845989/work
ipython-genutils==0.2.0
ipytree @ file:///home/conda/feedstock_root/build_artifacts/ipytree_1661272736017/work
ipywidgets==7.7.1
isoduration==20.11.0
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1696326070614/work
Jinja2==3.1.3
jmespath==1.0.1
joblib==1.3.2
json5==0.9.14
jsonpointer==2.4
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter-events==0.9.0
jupyter-lsp==2.2.2
jupyter_client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1699283905679/work
jupyter_core @ file:///D:/bld/jupyter_core_1704727196845/work
jupyter_server==2.12.5
jupyter_server_terminals==0.5.2
jupyterlab==4.1.0
jupyterlab-widgets @ file:///C:/b/abs_adrrqr26no/croot/jupyterlab_widgets_1700169018974/work
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.2
kiwisolver==1.4.5
lazy_loader==0.3
leidenalg==0.10.2
llvmlite==0.42.0
locket==1.0.0
magicgui==0.8.1
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.8.2
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1660814786464/work
mdurl==0.1.2
mistune==3.0.2
multidict==6.0.4
multiscale_spatial_image==0.11.2
mypy-extensions==1.0.0
napari==0.4.19
napari-console==0.0.9
napari-plugin-engine==0.2.0
napari-plugin-manager==0.1.0a2
napari-svg==0.1.10
natsort==8.4.0
nbclient==0.9.0
nbconvert==7.16.0
nbformat==5.9.2
nest_asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1705850609492/work
networkx==3.2.1
notebook==7.0.7
notebook_shim==0.2.3
npe2==0.7.4
numba==0.59.0
numcodecs==0.11.0
numpy==1.26.4
numpydoc==1.6.0
ome-zarr==0.8.1
opencv-python==4.9.0.80
openpyxl==3.1.2
overrides==7.7.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1696202382185/work
pandas==2.2.0
pandocfilters==1.5.1
parse==1.20.1
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1638334955874/work
partd==1.4.1
patsy==0.5.6
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
pillow==10.2.0
PIMS==0.6.1
Pint==0.23
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/platformdirs_1706713388748/work
pluggy==1.3.0
pooch==1.8.0
prometheus-client==0.19.0
prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1702399386289/work
psutil @ file:///D:/bld/psutil_1705722541723/work
psygnal==0.9.5
pure-eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1642875951954/work
pyarrow==14.0.2
pyconify==0.1.6
pycparser==2.21
pyct==0.5.0
pydantic==2.6.1
pydantic-compat==0.1.2
pydantic_core==2.16.2
pygeos==0.14
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1700607939962/work
pynndescent==0.5.11
PyOpenGL==3.1.7
pyparsing==3.1.1
pyproj==3.6.1
pyproject_hooks==1.0.0
PyQt5==5.15.10
PyQt5-Qt5==5.15.2
PyQt5-sip==12.13.0
pytest==7.4.2
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
python-json-logger==2.0.7
pytz==2024.1
PyWavelets==1.5.0
pywin32==306
pywinpty==2.0.12
PyYAML==6.0.1
pyzmq @ file:///D:/bld/pyzmq_1701783320990/work
qtconsole==5.5.1
QtPy==2.4.1
readfcs==1.1.6
referencing==0.33.0
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==13.7.0
rpds-py==0.17.1
scanorama==1.7.4
scanpy==1.9.8
scikit-image==0.21.0
scikit-learn==1.4.0
scipy==1.12.0
seaborn==0.13.2
Send2Trash==1.8.2
session-info==1.0.0
shapely==2.0.2
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
slicerator==1.1.0
sniffio==1.3.0
snowballstemmer==2.2.0
sortedcontainers==2.4.0
soupsieve==2.5
spatial_image==0.3.0
spatialdata-io==0.0.7
Sphinx==7.2.6
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
stack-data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1669632077133/work
statsmodels==0.14.1
stdlib-list==0.10.0
superqt==0.6.1
tabulate==0.9.0
terminado==0.18.0
texttable==1.7.0
threadpoolctl==3.2.0
tifffile==2024.1.30
tinycss2==1.2.1
tomli==2.0.1
tomli_w==1.0.0
toolz==0.12.1
tornado @ file:///D:/bld/tornado_1695373623388/work
tqdm==4.66.1
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1704212992681/work
triangle==20230923
typer==0.9.0
types-python-dateutil==2.8.19.20240106
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1702176139754/work
tzdata==2023.4
umap-learn==0.5.5
uri-template==1.3.0
urllib3==2.2.0
vispy==0.14.1
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1704731205417/work
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
widgetsnbextension==3.6.6
wrapt==1.16.0
xarray==2022.12.0
xarray-dataclasses==1.6.0
xarray-datatree==0.0.12
xarray-schema==0.0.3
xarray-spatial==0.3.7
xmltodict==0.13.0
xyzservices==2023.10.1
yarl==1.9.2
zarr==2.16.1
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1695255097490/work
jwrth commented 7 months ago

Hi again, a fresh start sometimes helps. I think I fixed it by restarting visual studio code and upgrading ipywidgets to 8.1.2. For now it is working again.

joshmoore commented 7 months ago

:+1: