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

permit run polars on old CPU #15404

Open
l1t1 opened this issue Mar 31, 2024 · 10 comments
Open

permit run polars on old CPU #15404

l1t1 opened this issue Mar 31, 2024 · 10 comments
Labels
enhancement New feature or an improvement of an existing feature

Comments

@l1t1
Copy link

l1t1 commented Mar 31, 2024

Description

I have an old PC, it reported following errors.
I hope polars can run on it.

C:\Users\lt>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 as pl
D:\Python312\Lib\site-packages\polars\_cpu_check.py:232: RuntimeWarning: Missing required CPU features.

The following required CPU features were not detected:
    sse4.2, popcnt, avx, avx2, fma, bmi1, bmi2, lzcnt, pclmulqdq
Continuing to use this version of Polars on this processor will likely result in a crash.
Install the `polars-lts-cpu` package instead of `polars` to run Polars with better compatibility.

Hint: If you are on an Apple ARM machine (e.g. M1) this is likely due to running Python under Rosetta.
It is recommended to install a native version of Python that does not run under Rosetta x86-64 emulation.

If you believe this warning to be a false positive, you can set the `POLARS_SKIP_CPU_CHECK` environment variable to bypass this check.

  warnings.warn(

 

C:\Users\lt>set POLARS_SKIP_CPU_CHECK=1

C:\Users\lt>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 as pl #exited python again
@l1t1 l1t1 added the enhancement New feature or an improvement of an existing feature label Mar 31, 2024
@l1t1
Copy link
Author

l1t1 commented Mar 31, 2024

I installed polars-lts-cpu package, but don't know how to import it. import polars-lts-cpu says invalid syntax

@l1t1
Copy link
Author

l1t1 commented Mar 31, 2024

I uninstalled both polars and polars-lts-cpu, then installed polars-lts-cpu again, when import polars, it shows following error. it says
there are still two features needed by it. sse4.2, popcnt. But in fact they also can be ignored. could it skip the checks by default?

>>> import polars as pl
D:\Python312\Lib\site-packages\polars\_cpu_check.py:232: RuntimeWarning: Missing required CPU features.

The following required CPU features were not detected:
    sse4.2, popcnt
Continuing to use this version of Polars on this processor will likely result in a crash.
Install the `polars-lts-cpu` package instead of `polars` to run Polars with better compatibility.

Hint: If you are on an Apple ARM machine (e.g. M1) this is likely due to running Python under Rosetta.
It is recommended to install a native version of Python that does not run under Rosetta x86-64 emulation.

If you believe this warning to be a false positive, you can set the `POLARS_SKIP_CPU_CHECK` environment variable to bypass this check.

  warnings.warn(

works

C:\Users\lt>set POLARS_SKIP_CPU_CHECK=1

C:\Users\lt>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
>>> import polars as pl
>>> df = pl.DataFrame(
... {
...     "A": [1, 2, 3, 4, 5],
...     "fruits": ["banana", "banana", "apple", "apple", "banana"],
...     "B": [5, 4, 3, 2, 1],
...     "cars": ["beetle", "audi", "beetle", "beetle", "beetle"],
... }
... )
>>> df.sort("fruits")
shape: (5, 4)
┌─────┬────────┬─────┬────────┐
│ A   ┆ fruits ┆ B   ┆ cars   │
│ --- ┆ ---    ┆ --- ┆ ---    │
│ i64 ┆ str    ┆ i64 ┆ str    │
╞═════╪════════╪═════╪════════╡
│ 3   ┆ apple  ┆ 3   ┆ beetle │
│ 4   ┆ apple  ┆ 2   ┆ beetle │
│ 1   ┆ banana ┆ 5   ┆ beetle │
│ 2   ┆ banana ┆ 4   ┆ audi   │
│ 5   ┆ banana ┆ 1   ┆ beetle │
└─────┴────────┴─────┴────────┘

1 similar comment
@l1t1
Copy link
Author

l1t1 commented Mar 31, 2024

I uninstalled both polars and polars-lts-cpu, then installed polars-lts-cpu again, when import polars, it shows following error. it says
there are still two features needed by it. sse4.2, popcnt. But in fact they also can be ignored. could it skip the checks by default?

>>> import polars as pl
D:\Python312\Lib\site-packages\polars\_cpu_check.py:232: RuntimeWarning: Missing required CPU features.

The following required CPU features were not detected:
    sse4.2, popcnt
Continuing to use this version of Polars on this processor will likely result in a crash.
Install the `polars-lts-cpu` package instead of `polars` to run Polars with better compatibility.

Hint: If you are on an Apple ARM machine (e.g. M1) this is likely due to running Python under Rosetta.
It is recommended to install a native version of Python that does not run under Rosetta x86-64 emulation.

If you believe this warning to be a false positive, you can set the `POLARS_SKIP_CPU_CHECK` environment variable to bypass this check.

  warnings.warn(

works

C:\Users\lt>set POLARS_SKIP_CPU_CHECK=1

C:\Users\lt>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
>>> import polars as pl
>>> df = pl.DataFrame(
... {
...     "A": [1, 2, 3, 4, 5],
...     "fruits": ["banana", "banana", "apple", "apple", "banana"],
...     "B": [5, 4, 3, 2, 1],
...     "cars": ["beetle", "audi", "beetle", "beetle", "beetle"],
... }
... )
>>> df.sort("fruits")
shape: (5, 4)
┌─────┬────────┬─────┬────────┐
│ A   ┆ fruits ┆ B   ┆ cars   │
│ --- ┆ ---    ┆ --- ┆ ---    │
│ i64 ┆ str    ┆ i64 ┆ str    │
╞═════╪════════╪═════╪════════╡
│ 3   ┆ apple  ┆ 3   ┆ beetle │
│ 4   ┆ apple  ┆ 2   ┆ beetle │
│ 1   ┆ banana ┆ 5   ┆ beetle │
│ 2   ┆ banana ┆ 4   ┆ audi   │
│ 5   ┆ banana ┆ 1   ┆ beetle │
└─────┴────────┴─────┴────────┘

@l1t1
Copy link
Author

l1t1 commented Mar 31, 2024

failed to run df.sort("fruits").select(

>>> import polars as pl
>>> df = pl.DataFrame(
...  {
...     "A": [1, 2, 3, 4, 5],
...     "fruits": ["banana", "banana", "apple", "apple", "banana"],
...     "B": [5, 4, 3, 2, 1],
...     "cars": ["beetle", "audi", "beetle", "beetle", "beetle"],
...  }
... )
>>> df.sort("fruits").select(
...  "fruits",
...  "cars",
...  pl.lit("fruits").alias("literal_string_fruits"),
...  pl.col("B").filter(pl.col("cars") == "beetle").sum(),
...  pl.col("A").filter(pl.col("B") > 2).sum().over("cars").alias("sum_A_by_cars"),
...  pl.col("A").sum().over("fruits").alias("sum_A_by_fruits"),
...  pl.col("A").reverse().over("fruits").alias("rev_A_by_fruits"),
...  pl.col("A").sort_by("B").over("fruits").alias("sort_A_by_B_by_fruits"),
... )

@ritchie46
Copy link
Member

What is your machine?

@l1t1
Copy link
Author

l1t1 commented Mar 31, 2024

my machine: intel core2 duo p8700

@ritchie46
Copy link
Member

I think we can remove those features from polars-lts-cpu.

@ritchie46
Copy link
Member

ritchie46 commented Apr 1, 2024

failed to run df.sort("fruits").select(

What doe you mean by failed? What happened?

I am a bit hesitant on understanding how old you machine is. As a popcnt is for instance required to boot the windows 11 kernel.

@l1t1
Copy link
Author

l1t1 commented Apr 1, 2024

failed to run df.sort("fruits").select( means python exit without output anything. I installed windows 10.

@l1t1
Copy link
Author

l1t1 commented Apr 24, 2024

the latest clickhouse supports my old cpu.
https://builds.clickhouse.com/master/amd64compat/clickhouse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants