home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 832404698

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
832404698 MDU6SXNzdWU4MzI0MDQ2OTg= 5038 [tests] ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). 490531 closed 0     11 2021-03-16T04:44:23Z 2021-03-16T20:15:38Z 2021-03-16T20:03:33Z CONTRIBUTOR      

What happened: I’m running tests of xarray while building it for packaging (Arch Linux), and they are 6 tests failures, all with this error message.

What you expected to happen: Tests should work. I’m not sure why a version 0.0.0 is reported while running tests in the build environment.

Full error log ``` __________________ TestDataArray.test_from_series_multiindex ___________________ self = <xarray.tests.test_dataarray.TestDataArray object at 0x7fcb3b23c2b0> def test_from_series_multiindex(self): # GH:3951 df = pd.DataFrame({"B": [1, 2, 3], "A": [4, 5, 6]}) df = df.rename_axis("num").rename_axis("alpha", axis=1) > actual = df.stack("alpha").to_xarray() /build/python-xarray/src/xarray-0.17.0/xarray/tests/test_dataarray.py:3697: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.9/site-packages/pandas/core/generic.py:3011: in to_xarray xarray = import_optional_dependency("xarray") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'xarray', extra = '', raise_on_missing = True, on_version = 'raise' def import_optional_dependency( name: str, extra: str = "", raise_on_missing: bool = True, on_version: str = "raise" ): """ Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be raised. If a dependency is present, but too old, we raise. Parameters ---------- name : str The module name. This should be top-level only, so that the version may be checked. extra : str Additional text to include in the ImportError message. raise_on_missing : bool, default True Whether to raise if the optional dependency is not found. When False and the module is not present, None is returned. on_version : str {'raise', 'warn'} What to do when a dependency's version is too old. * raise : Raise an ImportError * warn : Warn that the version is too old. Returns None * ignore: Return the module, even if the version is too old. It's expected that users validate the version locally when using ``on_version="ignore"`` (see. ``io/html.py``) Returns ------- maybe_module : Optional[ModuleType] The imported module, when found and the version is correct. None is returned when the package is not found and `raise_on_missing` is False, or when the package's version is too old and `on_version` is ``'warn'``. """ package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name msg = ( f"Missing optional dependency '{install_name}'. {extra} " f"Use pip or conda to install {install_name}." ) try: module = importlib.import_module(name) except ImportError: if raise_on_missing: raise ImportError(msg) from None else: return None minimum_version = VERSIONS.get(name) if minimum_version: version = get_version(module) if distutils.version.LooseVersion(version) < minimum_version: assert on_version in {"warn", "raise", "ignore"} msg = ( f"Pandas requires version '{minimum_version}' or newer of '{name}' " f"(version '{version}' currently installed)." ) if on_version == "warn": warnings.warn(msg, UserWarning) return None elif on_version == "raise": > raise ImportError(msg) E ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). /usr/lib/python3.9/site-packages/pandas/compat/_optional.py:126: ImportError _______________________ TestDataset.test_sel_categorical _______________________ self = <xarray.tests.test_dataset.TestDataset object at 0x7fcb3afb8640> def test_sel_categorical(self): ind = pd.Series(["foo", "bar"], dtype="category") df = pd.DataFrame({"ind": ind, "values": [1, 2]}) > ds = df.set_index("ind").to_xarray() /build/python-xarray/src/xarray-0.17.0/xarray/tests/test_dataset.py:1432: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.9/site-packages/pandas/core/generic.py:3011: in to_xarray xarray = import_optional_dependency("xarray") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'xarray', extra = '', raise_on_missing = True, on_version = 'raise' def import_optional_dependency( name: str, extra: str = "", raise_on_missing: bool = True, on_version: str = "raise" ): """ Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be raised. If a dependency is present, but too old, we raise. Parameters ---------- name : str The module name. This should be top-level only, so that the version may be checked. extra : str Additional text to include in the ImportError message. raise_on_missing : bool, default True Whether to raise if the optional dependency is not found. When False and the module is not present, None is returned. on_version : str {'raise', 'warn'} What to do when a dependency's version is too old. * raise : Raise an ImportError * warn : Warn that the version is too old. Returns None * ignore: Return the module, even if the version is too old. It's expected that users validate the version locally when using ``on_version="ignore"`` (see. ``io/html.py``) Returns ------- maybe_module : Optional[ModuleType] The imported module, when found and the version is correct. None is returned when the package is not found and `raise_on_missing` is False, or when the package's version is too old and `on_version` is ``'warn'``. """ package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name msg = ( f"Missing optional dependency '{install_name}'. {extra} " f"Use pip or conda to install {install_name}." ) try: module = importlib.import_module(name) except ImportError: if raise_on_missing: raise ImportError(msg) from None else: return None minimum_version = VERSIONS.get(name) if minimum_version: version = get_version(module) if distutils.version.LooseVersion(version) < minimum_version: assert on_version in {"warn", "raise", "ignore"} msg = ( f"Pandas requires version '{minimum_version}' or newer of '{name}' " f"(version '{version}' currently installed)." ) if on_version == "warn": warnings.warn(msg, UserWarning) return None elif on_version == "raise": > raise ImportError(msg) E ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). /usr/lib/python3.9/site-packages/pandas/compat/_optional.py:126: ImportError ____________________ TestDataset.test_sel_categorical_error ____________________ self = <xarray.tests.test_dataset.TestDataset object at 0x7fcb3b199220> def test_sel_categorical_error(self): ind = pd.Series(["foo", "bar"], dtype="category") df = pd.DataFrame({"ind": ind, "values": [1, 2]}) > ds = df.set_index("ind").to_xarray() /build/python-xarray/src/xarray-0.17.0/xarray/tests/test_dataset.py:1440: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.9/site-packages/pandas/core/generic.py:3011: in to_xarray xarray = import_optional_dependency("xarray") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'xarray', extra = '', raise_on_missing = True, on_version = 'raise' def import_optional_dependency( name: str, extra: str = "", raise_on_missing: bool = True, on_version: str = "raise" ): """ Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be raised. If a dependency is present, but too old, we raise. Parameters ---------- name : str The module name. This should be top-level only, so that the version may be checked. extra : str Additional text to include in the ImportError message. raise_on_missing : bool, default True Whether to raise if the optional dependency is not found. When False and the module is not present, None is returned. on_version : str {'raise', 'warn'} What to do when a dependency's version is too old. * raise : Raise an ImportError * warn : Warn that the version is too old. Returns None * ignore: Return the module, even if the version is too old. It's expected that users validate the version locally when using ``on_version="ignore"`` (see. ``io/html.py``) Returns ------- maybe_module : Optional[ModuleType] The imported module, when found and the version is correct. None is returned when the package is not found and `raise_on_missing` is False, or when the package's version is too old and `on_version` is ``'warn'``. """ package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name msg = ( f"Missing optional dependency '{install_name}'. {extra} " f"Use pip or conda to install {install_name}." ) try: module = importlib.import_module(name) except ImportError: if raise_on_missing: raise ImportError(msg) from None else: return None minimum_version = VERSIONS.get(name) if minimum_version: version = get_version(module) if distutils.version.LooseVersion(version) < minimum_version: assert on_version in {"warn", "raise", "ignore"} msg = ( f"Pandas requires version '{minimum_version}' or newer of '{name}' " f"(version '{version}' currently installed)." ) if on_version == "warn": warnings.warn(msg, UserWarning) return None elif on_version == "raise": > raise ImportError(msg) E ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). /usr/lib/python3.9/site-packages/pandas/compat/_optional.py:126: ImportError ___________________ TestDataset.test_categorical_multiindex ____________________ self = <xarray.tests.test_dataset.TestDataset object at 0x7fcb3ae86670> def test_categorical_multiindex(self): i1 = pd.Series([0, 0]) cat = pd.CategoricalDtype(categories=["foo", "baz", "bar"]) i2 = pd.Series(["baz", "bar"], dtype=cat) df = pd.DataFrame({"i1": i1, "i2": i2, "values": [1, 2]}).set_index( ["i1", "i2"] ) > actual = df.to_xarray() /build/python-xarray/src/xarray-0.17.0/xarray/tests/test_dataset.py:1487: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.9/site-packages/pandas/core/generic.py:3011: in to_xarray xarray = import_optional_dependency("xarray") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'xarray', extra = '', raise_on_missing = True, on_version = 'raise' def import_optional_dependency( name: str, extra: str = "", raise_on_missing: bool = True, on_version: str = "raise" ): """ Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be raised. If a dependency is present, but too old, we raise. Parameters ---------- name : str The module name. This should be top-level only, so that the version may be checked. extra : str Additional text to include in the ImportError message. raise_on_missing : bool, default True Whether to raise if the optional dependency is not found. When False and the module is not present, None is returned. on_version : str {'raise', 'warn'} What to do when a dependency's version is too old. * raise : Raise an ImportError * warn : Warn that the version is too old. Returns None * ignore: Return the module, even if the version is too old. It's expected that users validate the version locally when using ``on_version="ignore"`` (see. ``io/html.py``) Returns ------- maybe_module : Optional[ModuleType] The imported module, when found and the version is correct. None is returned when the package is not found and `raise_on_missing` is False, or when the package's version is too old and `on_version` is ``'warn'``. """ package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name msg = ( f"Missing optional dependency '{install_name}'. {extra} " f"Use pip or conda to install {install_name}." ) try: module = importlib.import_module(name) except ImportError: if raise_on_missing: raise ImportError(msg) from None else: return None minimum_version = VERSIONS.get(name) if minimum_version: version = get_version(module) if distutils.version.LooseVersion(version) < minimum_version: assert on_version in {"warn", "raise", "ignore"} msg = ( f"Pandas requires version '{minimum_version}' or newer of '{name}' " f"(version '{version}' currently installed)." ) if on_version == "warn": warnings.warn(msg, UserWarning) return None elif on_version == "raise": > raise ImportError(msg) E ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). /usr/lib/python3.9/site-packages/pandas/compat/_optional.py:126: ImportError _________________ TestDataset.test_from_dataframe_categorical __________________ self = <xarray.tests.test_dataset.TestDataset object at 0x7fcb3ab0b880> def test_from_dataframe_categorical(self): cat = pd.CategoricalDtype( categories=["foo", "bar", "baz", "qux", "quux", "corge"] ) i1 = pd.Series(["foo", "bar", "foo"], dtype=cat) i2 = pd.Series(["bar", "bar", "baz"], dtype=cat) df = pd.DataFrame({"i1": i1, "i2": i2, "values": [1, 2, 3]}) > ds = df.set_index("i1").to_xarray() /build/python-xarray/src/xarray-0.17.0/xarray/tests/test_dataset.py:4131: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.9/site-packages/pandas/core/generic.py:3011: in to_xarray xarray = import_optional_dependency("xarray") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'xarray', extra = '', raise_on_missing = True, on_version = 'raise' def import_optional_dependency( name: str, extra: str = "", raise_on_missing: bool = True, on_version: str = "raise" ): """ Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be raised. If a dependency is present, but too old, we raise. Parameters ---------- name : str The module name. This should be top-level only, so that the version may be checked. extra : str Additional text to include in the ImportError message. raise_on_missing : bool, default True Whether to raise if the optional dependency is not found. When False and the module is not present, None is returned. on_version : str {'raise', 'warn'} What to do when a dependency's version is too old. * raise : Raise an ImportError * warn : Warn that the version is too old. Returns None * ignore: Return the module, even if the version is too old. It's expected that users validate the version locally when using ``on_version="ignore"`` (see. ``io/html.py``) Returns ------- maybe_module : Optional[ModuleType] The imported module, when found and the version is correct. None is returned when the package is not found and `raise_on_missing` is False, or when the package's version is too old and `on_version` is ``'warn'``. """ package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name msg = ( f"Missing optional dependency '{install_name}'. {extra} " f"Use pip or conda to install {install_name}." ) try: module = importlib.import_module(name) except ImportError: if raise_on_missing: raise ImportError(msg) from None else: return None minimum_version = VERSIONS.get(name) if minimum_version: version = get_version(module) if distutils.version.LooseVersion(version) < minimum_version: assert on_version in {"warn", "raise", "ignore"} msg = ( f"Pandas requires version '{minimum_version}' or newer of '{name}' " f"(version '{version}' currently installed)." ) if on_version == "warn": warnings.warn(msg, UserWarning) return None elif on_version == "raise": > raise ImportError(msg) E ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). /usr/lib/python3.9/site-packages/pandas/compat/_optional.py:126: ImportError _________________________ test_roundtrip_pandas_series _________________________ @given(numeric_series, st.text()) > def test_roundtrip_pandas_series(ser, ix_name): /build/python-xarray/src/xarray-0.17.0/properties/test_pandas_roundtrip.py:73: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /build/python-xarray/src/xarray-0.17.0/properties/test_pandas_roundtrip.py:79: in test_roundtrip_pandas_series xr.testing.assert_identical(arr, roundtripped.to_xarray()) /usr/lib/python3.9/site-packages/pandas/core/generic.py:3011: in to_xarray xarray = import_optional_dependency("xarray") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'xarray', extra = '', raise_on_missing = True, on_version = 'raise' def import_optional_dependency( name: str, extra: str = "", raise_on_missing: bool = True, on_version: str = "raise" ): """ Import an optional dependency. By default, if a dependency is missing an ImportError with a nice message will be raised. If a dependency is present, but too old, we raise. Parameters ---------- name : str The module name. This should be top-level only, so that the version may be checked. extra : str Additional text to include in the ImportError message. raise_on_missing : bool, default True Whether to raise if the optional dependency is not found. When False and the module is not present, None is returned. on_version : str {'raise', 'warn'} What to do when a dependency's version is too old. * raise : Raise an ImportError * warn : Warn that the version is too old. Returns None * ignore: Return the module, even if the version is too old. It's expected that users validate the version locally when using ``on_version="ignore"`` (see. ``io/html.py``) Returns ------- maybe_module : Optional[ModuleType] The imported module, when found and the version is correct. None is returned when the package is not found and `raise_on_missing` is False, or when the package's version is too old and `on_version` is ``'warn'``. """ package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name msg = ( f"Missing optional dependency '{install_name}'. {extra} " f"Use pip or conda to install {install_name}." ) try: module = importlib.import_module(name) except ImportError: if raise_on_missing: raise ImportError(msg) from None else: return None minimum_version = VERSIONS.get(name) if minimum_version: version = get_version(module) if distutils.version.LooseVersion(version) < minimum_version: assert on_version in {"warn", "raise", "ignore"} msg = ( f"Pandas requires version '{minimum_version}' or newer of '{name}' " f"(version '{version}' currently installed)." ) if on_version == "warn": warnings.warn(msg, UserWarning) return None elif on_version == "raise": > raise ImportError(msg) E ImportError: Pandas requires version '0.12.3' or newer of 'xarray' (version '0.0.0' currently installed). /usr/lib/python3.9/site-packages/pandas/compat/_optional.py:126: ImportError ```

Environment:

Output of <tt>xr.show_versions()</tt> commit: None python: 3.9.2 (default, Feb 20 2021, 18:40:11) [GCC 10.2.0] python-bits: 64 OS: Linux OS-release: 5.11.5-arch1-1 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.12.0 libnetcdf: 4.7.4 xarray: 0.0.0 pandas: 1.2.3 numpy: 1.20.1 scipy: 1.6.1 netCDF4: 1.5.5.1 pydap: None h5netcdf: None h5py: 3.1.0 Nio: None zarr: None cftime: 1.4.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2021.03.0 distributed: 2021.03.0 matplotlib: 3.3.4 cartopy: None seaborn: 0.11.1 numbagg: None pint: 0.16.1 setuptools: 54.1.1 pip: None conda: None pytest: 6.2.2 IPython: None sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5038/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 11 rows from issue in issue_comments
Powered by Datasette · Queries took 478.874ms · About: xarray-datasette