polars
polars copied to clipboard
Import error when using scan_delta
Polars version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of Polars.
Issue description
I get the following import error while using polars with the new scan_delta method:
AttributeError: module 'pyarrow' has no attribute 'fs'
Reproducible example
import polars as pl
df = pl.scan_delta("/data/nytaxi")
print(df)
Expected behavior
No import error
Installed versions
---Version info---
Polars: 0.15.4
Index type: UInt32
Platform: macOS-13.0.1-arm64-arm-64bit
Python: 3.10.8 (v3.10.8:aaaf517424, Oct 11 2022, 10:14:40) [Clang 13.0.0 (clang-1300.0.29.30)]
---Optional dependencies---
pyarrow: 10.0.1
pandas:
@chitralverma could you take a look at this one?
Let me check it out today.
@ritchie46 , I checked this and it seems that this is coming because I imported a sub module from the lazily loaded pyarrow, see here. I believe I will have to switch this with the below or do you recommend so other better way to lazily import sub modules also?
from pyarrow import fs as pa_fs
raw_filesystem, normalized_path = pa_fs.FileSystem.from_uri(table_uri)
Surprisingly this was not not caught in the unit tests for some reason.
@dominikpeter this issue will also happen for read_delta
er way to lazily import sub modules als
Can we import the needed pyarrow submodules within the function itself? That should prevent all issues related to lazy imports.