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]: missing dependency 'pyarrow-hotfix' for tests #589

Closed
aidoskanapyanov opened this issue Jul 23, 2024 · 4 comments · Fixed by #591
Closed

[Bug]: missing dependency 'pyarrow-hotfix' for tests #589

aidoskanapyanov opened this issue Jul 23, 2024 · 4 comments · Fixed by #591

Comments

@aidoskanapyanov
Copy link
Contributor

Describe the bug

After following a CONTRIBUTING.md and installing all dependencies and running pytest, test tests/frame/interchange_schema_test.py fails.

Steps or code to reproduce the bug

Follow CONTRIBUTING.md and install all dependencies, then run pytest.

Expected results

Expected to pass all tests without dependency issues.

Actual results

Test tests/frame/interchange_schema_test.py fails with ModuleNotFoundError due to missing dependency pyarrow-hotfix

Please run narwhals.show_version() and enter the output below.

System:
    python: 3.11.9 (main, Apr  6 2024, 17:59:24) [GCC 9.4.0]
executable: /home/aidos/dev/personal-projects/narwhals/.venv/bin/python
   machine: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.31

Python dependencies:
     narwhals: 1.1.4
       pandas: 2.2.2
       polars: 1.2.1
         cudf: 
        modin: 
      pyarrow: 17.0.0
        numpy: 2.0.1

Relevant log output

================================================================= FAILURES =================================================================
_________________________________________________________ test_interchange_schema __________________________________________________________

    @pytest.mark.skipif(
        parse_version(ibis.__version__) < (6, 0),
        reason="too old, requires interchange protocol",
    )
    def test_interchange_schema() -> None:
        df_pl = pl.DataFrame(
            {
                "a": [1, 1, 2],
                "b": [4, 5, 6],
                "c": [4, 5, 6],
                "d": [4, 5, 6],
                "e": [4, 5, 6],
                "f": [4, 5, 6],
                "g": [4, 5, 6],
                "h": [4, 5, 6],
                "i": [4, 5, 6],
                "j": [4, 5, 6],
                "k": ["fdafsd", "fdas", "ad"],
                "l": ["fdafsd", "fdas", "ad"],
                "m": [date(2021, 1, 1), date(2021, 1, 1), date(2021, 1, 1)],
                "n": [True, True, False],
            },
            schema={
                "a": pl.Int64,
                "b": pl.Int32,
                "c": pl.Int16,
                "d": pl.Int8,
                "e": pl.UInt64,
                "f": pl.UInt32,
                "g": pl.UInt16,
                "h": pl.UInt8,
                "i": pl.Float64,
                "j": pl.Float32,
                "k": pl.String,
                "l": pl.Categorical,
                "m": pl.Datetime,
                "n": pl.Boolean,
            },
        )
        tbl = ibis.memtable(df_pl)
        df = nw.from_native(tbl, eager_or_interchange_only=True)
>       result = df.schema

tests/frame/interchange_schema_test.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
narwhals/dataframe.py:743: in schema
    return super().schema
narwhals/dataframe.py:83: in schema
    return Schema(self._compliant_frame.schema.items())
narwhals/_interchange/dataframe.py:84: in schema
    return {
narwhals/_interchange/dataframe.py:86: in <dictcomp>
    self._native_dataframe.get_column_by_name(column_name).dtype
.venv/lib/python3.11/site-packages/ibis/expr/types/dataframe_interchange.py:141: in dtype
    return self._df._get_dtype(self._name)
.venv/lib/python3.11/site-packages/ibis/expr/types/dataframe_interchange.py:64: in _get_dtype
    return self._empty_pyarrow_df.get_column_by_name(name).dtype
/usr/lib/python3.11/functools.py:1001: in __get__
    val = self.func(instance)
.venv/lib/python3.11/site-packages/ibis/expr/types/dataframe_interchange.py:60: in _empty_pyarrow_df
    return self._table.schema().to_pyarrow().empty_table().__dataframe__()
.venv/lib/python3.11/site-packages/ibis/expr/schema.py:184: in to_pyarrow
    return PyArrowSchema.from_ibis(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'ibis.formats.pyarrow.PyArrowSchema'>
schema = ibis.Schema {
  a  int64
  b  int32
  c  int16
  d  int8
  e  uint64
  f  uint32
  g  uint16
  h  uint8
  i  float64
  j  float32
  k  string
  l  string
  m  timestamp(6)
  n  boolean
}

    @classmethod
    def from_ibis(cls, schema: Schema) -> pa.Schema:
        """Convert a schema to a pyarrow schema."""
        import pyarrow as pa
>       import pyarrow_hotfix  # noqa: F401
E       ModuleNotFoundError: No module named 'pyarrow_hotfix'

.venv/lib/python3.11/site-packages/ibis/formats/pyarrow.py:262: ModuleNotFoundError
========================================================= short test summary info ==========================================================
FAILED tests/frame/interchange_schema_test.py::test_interchange_schema - ModuleNotFoundError: No module named 'pyarrow_hotfix'
========================================== 1 failed, 1642 passed, 8 skipped, 60 xfailed in 8.37s ===========================================
@aidoskanapyanov
Copy link
Contributor Author

pip install pyarrow-hotfix fixes the issue. Maybe it should be added to requirements-dev.txt?

@FBruzzesi
Copy link
Member

Hi @aidoskanapyanov thanks for reporting this! I noticed this as well this morning, and it is the first time it appears!

Maybe it should be added to requirements-dev.txt?

Yes let's do that!

@MarcoGorelli
Copy link
Member

thanks @aidoskanapyanov ! I think if we modify ibis-framework to ibis-framework[polars] that should be enough? want to make a PR?

@aidoskanapyanov
Copy link
Contributor Author

@MarcoGorelli thank you for the suggestion, I added a quick PR to resolve this. pytest works now, with ibis-framework[polars] being the dependency.

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

Successfully merging a pull request may close this issue.

3 participants