0

I would like to use the python package polars-lts-cpu, since I am facing some hardware issues on a gitlab runner. How do I import this package in Python, i.e. what is the alias?

A simple import polars-lts-cpu yields a syntax error. The documentation does not give any hints or suggestions.

Any help would be appreciated.

Tonelock
  • 33
  • 4
  • Hi, thank you for your quick answer. Maybe I did not understand this correctly: Is it just a supplementary package and is not used without `polars` itself and therefore not imported? – Tonelock Dec 19 '22 at 22:55
  • Okay. The documentation is identical to the one of the actual [polars](https://pypi.org/project/polars/) package as far as I can see. So the examples provided there might not be correct for polars-lts-cpu. – Tonelock Dec 19 '22 at 23:09
  • 1
    I tried `import polars` already which did not help. – Tonelock Dec 19 '22 at 23:18
  • Does this answer your question? [How to import module when module name has a '-' dash or hyphen in it?](https://stackoverflow.com/questions/8350853/how-to-import-module-when-module-name-has-a-dash-or-hyphen-in-it) – Woodford Dec 19 '22 at 23:21
  • Thanks for the hint! Unfortunately, the provided solutions there do not solve my problem, I receive a `ModuleNotFoundError: No module named 'polars-lts-cpu'` . – Tonelock Dec 19 '22 at 23:32

1 Answers1

0

Usage is exactly the same as with the default polars package. So you import polars, not polars-lts-cpu.

me:~: $ pip install -U polars-lts-cpu
Collecting polars-lts-cpu
  Downloading polars_lts_cpu-0.15.7-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.6 MB)
     |████████████████████████████████| 14.6 MB 11.7 MB/s 
me:~: $ python -c "import polars as pl; print(pl.__version__)"
0.15.7
ritchie46
  • 10,405
  • 1
  • 24
  • 43
  • I too suggested this in a comment based on the documentation that op linked, but apparently it didn't work for op https://stackoverflow.com/questions/74856814/how-to-import-polars-lts-cpu-correctly#comment132107135_74856814 – Pranav Hosangadi Dec 20 '22 at 07:18
  • Maybe he must uninstall the the other polars binary. I just created a new environment and can confirm it works. – ritchie46 Dec 20 '22 at 07:43
  • Hi everyone, I uninstalled polars and tried to use polats-lts-cpu instead, without changing any mport code, and got a ModuleNotFoundError. I will have another look into this, thanks for the hint. – Tonelock Dec 20 '22 at 08:15
  • Recreating the venv and reinstalling polars-lts-cpu solved the problem, I can import it now via `import polars` as @ritchie46 suggested. Thanks! – Tonelock Dec 20 '22 at 08:39