PyPSA / linopy

Linear optimization with N-D labeled arrays in Python
https://linopy.readthedocs.io
MIT License
162 stars 45 forks source link

Cannot import "Coordinates" from xarray #216

Closed erik-rossbach-DUS closed 8 months ago

erik-rossbach-DUS commented 9 months ago

In the file expressions.py, line 23, there is a call to import Coordinates from xarray

However, this line kept raising an error:

ImportError: cannot import name 'Coordinates' from 'xarray'

I have found simply removing the s in 'Coordinates' fixed this issue:

from xarray import Coordinate**s**, DataArray, Dataset -> from xarray import Coordinate, DataArray, Dataset

FabianHofmann commented 9 months ago

interesting, could you say which xarray version you are using?

erik-rossbach-DUS commented 9 months ago

I am using:

FabianHofmann commented 9 months ago

could you update your xarray version and try again?

erik-rossbach-DUS commented 8 months ago

I was under the wrong impression that I had the most recent version of xarray installed.

Indeed, the import statement works with the most recent release of xarray v. 2023.12

Thank you for your help!