Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ImportError: cannot import name 'HybridMappingProxy #164

Closed
NadineBestard opened this issue Dec 17, 2024 · 1 comment
Closed

[Bug] ImportError: cannot import name 'HybridMappingProxy #164

NadineBestard opened this issue Dec 17, 2024 · 1 comment

Comments

@NadineBestard
Copy link

Description

With the new version [1.1.6] - 2024-11-29 DataTree from xarray is imported. In order to have this functionality xarray is updated to xarray-2024.11.0, as earlier versions give ImportError: cannot import name 'DataTree' from 'xarray'. But now when importing Sopa I get ImportError: cannot import name 'HybridMappingProxy' from 'xarray.core.utils' reported to happen after 2024.10.0 xarray update, as described here scverse/squidpy#907

Reproducing the issue

$ pip install xarray==2024.09.0
$ python
>>> from xarray import DataTree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'DataTree' from 'xarray' (C:\Users\[...]\anaconda3\envs\Sopa2\Lib\site-packages\xarray\__init__.py). Did you mean: 'Dataset'?
>>> exit()
$ pip install xarray==2024.11.0
$ python
>>> from xarray import DataTree # this now works
>>> xarray.core.utils.HybridMappingProxy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'xarray.core.utils' has no attribute 'HybridMappingProxy'

Expected behavior

Sopa to be loaded with no errors

System

  • OS: Windows
  • Python version 3.12.7
Dependencies versions
Package Version Editable project location ------------------------- ----------- --------------------------------------------------- aiobotocore 2.5.4 aiohappyeyeballs 2.4.3 aiohttp 3.11.7 aioitertools 0.12.0 aiosignal 1.3.1 anndata 0.11.1 anyio 4.6.2 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 array_api_compat 1.9.1 asciitree 0.3.3 asttokens 2.0.5 async-lru 2.0.4 attrs 24.2.0 Babel 2.11.0 beautifulsoup4 4.12.3 bleach 6.2.0 botocore 1.31.17 Brotli 1.0.9 certifi 2024.8.30 cffi 1.17.1 charset-normalizer 3.3.2 click 8.1.7 cloudpickle 3.1.0 colorama 0.4.6 colorcet 3.1.0 comm 0.2.1 contourpy 1.3.1 cycler 0.12.1 dask 2024.11.2 dask-expr 1.1.19 dask-image 2024.5.3 datashader 0.16.3 debugpy 1.6.7 decorator 5.1.1 defusedxml 0.7.1 distributed 2024.11.2 executing 0.8.3 fasteners 0.19 fastjsonschema 2.20.0 fcsparser 0.2.8 flake8 7.1.1 fonttools 4.55.0 frozenlist 1.5.0 fsspec 2023.6.0 geopandas 1.0.1 h11 0.14.0 h5py 3.12.1 httpcore 1.0.2 httpx 0.27.0 idna 3.7 imagecodecs 2024.9.22 imageio 2.36.0 ipykernel 6.29.5 ipython 8.27.0 jedi 0.19.1 Jinja2 3.1.4 jmespath 1.0.1 joblib 1.4.2 json5 0.9.25 jsonschema 4.23.0 jsonschema-specifications 2023.7.1 jupyter_client 8.6.0 jupyter_core 5.7.2 jupyter-events 0.10.0 jupyter-lsp 2.2.0 jupyter_server 2.14.1 jupyter_server_terminals 0.4.4 jupyterlab 4.2.5 jupyterlab-pygments 0.1.2 jupyterlab_server 2.27.3 kiwisolver 1.4.7 lamin_utils 0.13.9 lazy_loader 0.4 legacy-api-wrap 1.4.1 llvmlite 0.43.0 locket 1.0.0 markdown-it-py 3.0.0 MarkupSafe 2.1.3 matplotlib 3.9.2 matplotlib-inline 0.1.6 mccabe 0.7.0 mdurl 0.1.2 mistune 2.0.4 msgpack 1.1.0 multidict 6.1.0 multipledispatch 1.0.0 multiscale_spatial_image 2.0.2 natsort 8.4.0 nbclient 0.8.0 nbconvert 7.16.4 nbformat 5.10.4 nest-asyncio 1.6.0 networkx 3.4.2 notebook 7.2.2 notebook_shim 0.2.3 numba 0.60.0 numcodecs 0.14.1 numpy 1.26.4 ome-zarr 0.9.0 opencv-python 4.10.0.84 overrides 7.4.0 packaging 24.1 pandas 2.2.3 pandocfilters 1.5.0 param 2.1.1 parso 0.8.3 partd 1.4.2 patsy 1.0.1 pillow 11.0.0 PIMS 0.7 pip 24.2 platformdirs 3.10.0 pooch 1.8.2 prometheus_client 0.21.0 prompt-toolkit 3.0.43 propcache 0.2.0 psutil 5.9.0 pure-eval 0.2.2 pyarrow 18.1.0 pycodestyle 2.12.1 pycparser 2.21 pyct 0.5.0 pyflakes 3.2.0 Pygments 2.15.1 pynndescent 0.5.13 pyogrio 0.10.0 pyparsing 3.2.0 pyproj 3.7.0 PySocks 1.7.1 python-dateutil 2.9.0.post0 python-json-logger 2.0.7 pytz 2024.1 pywin32 305.1 pywinpty 2.0.10 PyYAML 6.0.2 pyzmq 25.1.2 readfcs 1.1.9 referencing 0.30.2 requests 2.32.3 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rich 13.9.4 rpds-py 0.10.6 s3fs 2023.6.0 scanpy 1.10.4 scikit-image 0.24.0 scikit-learn 1.5.2 scipy 1.12.0 seaborn 0.13.2 Send2Trash 1.8.2 session_info 1.0.0 setuptools 75.1.0 shapely 2.0.6 shellingham 1.5.4 six 1.16.0 slicerator 1.1.0 sniffio 1.3.0 sopa 1.1.6 S:\biology\groups\CRM_SingleCell\Spatial\Sopa2\Sopa sortedcontainers 2.4.0 soupsieve 2.5 spatial_image 1.1.0 spatialdata 0.2.6 spatialdata-io 0.1.5 stack-data 0.2.0 statsmodels 0.14.4 stdlib-list 0.11.0 tblib 3.0.0 terminado 0.17.1 threadpoolctl 3.5.0 tifffile 2024.9.20 tinycss2 1.2.1 toolz 1.0.0 tornado 6.4.1 tqdm 4.67.1 traitlets 5.14.3 typer 0.13.1 typing_extensions 4.11.0 tzdata 2024.2 umap-learn 0.5.7 urllib3 1.26.20 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 1.8.0 wheel 0.44.0 win-inet-pton 1.1.0 wrapt 1.17.0 xarray 2024.11.0 xarray-dataclasses 1.8.0 xarray-datatree 0.0.15 xarray-schema 0.0.3 xarray-spatial 0.4.0 yarl 1.18.0 zarr 2.18.3 zict 3.0.0
@quentinblampey
Copy link
Collaborator

Hello @NadineBestard, this should actually be resolved if you update all the dependencies.

Can you try to upgrade Sopa with pip install sopa --upgrade? This should notably install spatialdata>=0.2.6 and spatialdata-io>=0.1.6, which support the new Xarray version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants