When compiling polars python package I get following error, any idea which version of rust should I use? Is there any workaround/fix for this?
I used following commands:
python -m pip install --no-binary :all: maturin
python -m pip install --no-binary :all: Polars==0.18.15
C:\Users\ashish.shirodkar>rustc --version
rustc 1.74.0-nightly (58eefc33a 2023-08-24)
Error:
Compiling pyo3-built v0.4.7
Compiling lz4 v1.24.0
Compiling zstd v0.12.4
Compiling parquet2 v0.17.2
Compiling polars-error v0.32.0 (C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-install-cor5irss\polars_180ec2d9ea9044ce86687698c1427599\local_dependencies\polars-error)
Compiling polars-row v0.32.0 (C:\Users\ashish.shirodkar\AppData\Local\Temp\pip-install-cor5irss\polars_180ec2d9ea9044ce86687698c1427599\local_dependencies\polars-row)
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
--> local_dependencies\polars-core\src\chunked_array\ops\rolling_window.rs:120:29
|
96 | let ptr = array_ptr.as_ref() as *const dyn Array as *mut dyn Array
| _______________________-
97 | | as *mut PrimitiveArray<T::Native>;
| |_________________________________________________- casting happend here
...
120 | *ptr = arr_window;
| ^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
= note: `#[deny(invalid_reference_casting)]` on by default
I tried using older rust versions but no luck.
I followed below steps as mentioned by @ritchie46 and it worked:
Get the version source code from GitHUB: https://github.com/pola-rs/polars/releases/tag/py-0.18.15
Install rust compiler from https://www.rust-lang.org/tools/install
Get the version of rust mentioned in rust-toolchain.toml in source downloaded from GitHub.
rustup install nightly-2023-07-27
rustup default nightly-2023-07-27-x86_64-pc-windows-msvc
C:\Users\ashish.shirodkar>rustc --version
rustc 1.73.0-nightly (0d95f9132 2023-07-26)
Execute following commands to compile and install Polars:
python -m pip install --no-binary :all: maturin
python -m pip install --no-binary :all: Polars==0.18.15