pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
29.29k stars 1.85k forks source link

polars failed to import after install version newer than 0.20.16 #15450

Open l1t1 opened 5 months ago

l1t1 commented 5 months ago

Checks

Reproducible example

pip install jupysql duckdb-engine
pip install asqlcell
pip install polars -U

then

C:\Users\LD>python
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import polars as pl
D:\Python38\lib\site-packages\polars\meta\build.py:5: UserWarning: Polars binary is missing!
  from polars._utils.polars_version import get_polars_version
>>> df = pl.read_parquet("d:/1687.zstd.parquet")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python38\lib\site-packages\polars\_utils\deprecation.py", line 134, in wrapper
    return function(*args, **kwargs)
  File "D:\Python38\lib\site-packages\polars\_utils\deprecation.py", line 134, in wrapper
    return function(*args, **kwargs)
  File "D:\Python38\lib\site-packages\polars\io\parquet\functions.py", line 171, in read_parquet
    lf = scan_parquet(
  File "D:\Python38\lib\site-packages\polars\_utils\deprecation.py", line 134, in wrapper
    return function(*args, **kwargs)
  File "D:\Python38\lib\site-packages\polars\_utils\deprecation.py", line 134, in wrapper
    return function(*args, **kwargs)
  File "D:\Python38\lib\site-packages\polars\io\parquet\functions.py", line 311, in scan_parquet
    return pl.LazyFrame._scan_parquet(
  File "D:\Python38\lib\site-packages\polars\lazyframe\frame.py", line 472, in _scan_parquet
    self._ldf = PyLazyFrame.new_from_parquet(
NameError: name 'PyLazyFrame' is not defined

Log output

No response

Issue description

all features of polars cannot be use

Expected behavior

it works as normal

Installed versions

``` --------Version info--------- Polars: Traceback (most recent call last): File "", line 1, in File "D:\Python38\lib\site-packages\polars\meta\versions.py", line 53, in show_versions print(f"{'Index type:':{keylen}s} {get_index_type()}") File "D:\Python38\lib\site-packages\polars\meta\index_type.py", line 27, in get_index_type return plr.get_index_type() NameError: name 'plr' is not defined ```
l1t1 commented 5 months ago

pip logs pip-log.txt

l1t1 commented 5 months ago

version 0.20.19 still cannot run

D:\>pip install polars -U
WARNING: Ignoring invalid distribution -uckdb (d:\python38\lib\site-packages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: polars in d:\python38\lib\site-packages (0.20.18)
Collecting polars
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a6/78/d8ce1fe04adb29fa25bdc56c27a07bbbdd3acb3e8eedc4c116a427f86ee9/polars-0.20.19-cp38-abi3-win_amd64.whl (26.2 MB)
     ---------------------------------------- 26.2/26.2 MB 22.6 MB/s eta 0:00:00
WARNING: Ignoring invalid distribution -uckdb (d:\python38\lib\site-packages)
DEPRECATION: pytorch-lightning 1.7.7 has a non-standard dependency specifier torch>=1.9.*. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pytorch-lightning or contact the author to s
uggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: polars
  Attempting uninstall: polars
    Found existing installation: polars 0.20.18
    Uninstalling polars-0.20.18:
      Successfully uninstalled polars-0.20.18
Successfully installed polars-0.20.19

C:\Users\LD>python
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import polars
D:\Python38\lib\site-packages\polars\meta\build.py:5: UserWarning: Polars binary is missing!
  from polars._utils.polars_version import get_polars_version
>>> polars.__version__
''
l1t1 commented 5 months ago

but If I install it on a new machine, everything is ok

C:\Users\LD>pip install polars
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting polars
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a6/78/d8ce1fe04adb29fa25bdc56c27a07bbbdd3acb3e8eedc4c116a427f86ee9/polars-0.20.19-cp38-abi3-win_amd64.whl (26.2 MB)
     ---------------------------------------- 26.2/26.2 MB 13.6 MB/s eta 0:00:00
Installing collected packages: polars
Successfully installed polars-0.20.19

C:\Users\LD>pip list installed
Package Version
------- -------
pip     24.0
polars  0.20.19

C:\Users\LD>python
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import polars
>>> polars.__version__
'0.20.19'
im5h commented 5 months ago

This error message only appears on Windows 7 systems. It works fine on Windows 11 systems. Based on my testing, installing a version higher than 0.20.16 on Windows 7 results in this error, while installing version 0.20.16 works correctly.

这个报错信息只出现在Windows7系统上,在Windows11系统上正常,经过我的测试,在Windows7上安装大于0.20.16的版本就会有这个报错,安装0.20.16版本则正常。

l1t1 commented 5 months ago

This error message only appears on Windows 7 systems. It works fine on Windows 11 systems. Based on my testing, installing a version higher than 0.20.16 on Windows 7 results in this error, while installing version 0.20.16 works correctly.

这个报错信息只出现在Windows7系统上,在Windows11系统上正常,经过我的测试,在Windows7上安装大于0.20.16的版本就会有这个报错,安装0.20.16版本则正常。

you are right, 0.20.16 is ok

C:\Users\LD>pip install polars==0.20.16
WARNING: Ignoring invalid distribution -uckdb (d:\python38\lib\site-packages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting polars==0.20.16
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ed/bd/35e3480f180c3e9bc57ef402c0b6e881da6909aaeff4eb31790e2e07beea/polars-0.20.16-cp38-abi3-win_amd64.whl (26.1 MB)
     ---------------------------------------- 26.1/26.1 MB 34.5 MB/s eta 0:00:00
WARNING: Ignoring invalid distribution -uckdb (d:\python38\lib\site-packages)
DEPRECATION: pytorch-lightning 1.7.7 has a non-standard dependency specifier torch>=1.9.*. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pytorch-lightning or contact the author to s
uggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: polars
  Attempting uninstall: polars
    Found existing installation: polars 0.20.19
    Uninstalling polars-0.20.19:
      Successfully uninstalled polars-0.20.19
Successfully installed polars-0.20.16

C:\Users\LD>python
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import polars
>>> polars.__version__
'0.20.16'
>>> df = polars.read_parquet("d:/1687.zstd.parquet")
>>> df
shape: (16_870_000, 16)
cmdlineluser commented 5 months ago

Not sure if it will be any help here but trying to read polars.abi3.so with ctypes.DLL() may yield some extra error information.

https://github.com/pola-rs/polars/issues/13094#issuecomment-1859504731

(Not sure if the same applies for Windows)

eitsupi commented 5 months ago

Maybe related to rust-lang/rust#121317

If I understand correctly, rustc no longer generates binaries compatible with Windows 7 by default. So if you build polars from source it may work.