-
Notifications
You must be signed in to change notification settings - Fork 129
Description
Hi I'm really interested in using this to speed up some python code, I have been looking at the examples here:
https://github.com/PyO3/rust-numpy/blob/main/examples/simple-extension/Cargo.toml
and here:
https://lib.rs/crates/numpy (under Write a Python module in Rust)
The bottom one has:
use ndarray::{ArrayD, ArrayViewD, ArrayViewMutD};
in lib.rs
but ndarray is not a dependency in cargo.toml, I tried adding it to the dependency list but I can't get it to compile (example error below), from looking at other issues it seems like people kind of know this happens...
The other example has:
[dependencies]
numpy = { path = "../.." }
In cargo.toml, which also obviously isn't going to work on my machine. Is it possible to get a beginer friendly example that compiles?
Error from ndarray:
error[E0277]: the trait bound <S as data_traits::DataOwned>::MaybeUninit: RawDataSubst<A> is not satisfied
--> C:\Users--me--.cargo\registry\src\github.com-1ecc6299db9ec823\ndarray-0.15.4\src\impl_ops.rs:401:12
|
401 | S: DataOwned<Elem = A> + DataMut,
| ^^^^^^^^^^^^^^^^^^^ the trait RawDataSubst<A> is not implemented for <S as data_traits::DataOwned>::MaybeUninit
|
::: C:\Users--me--.cargo\registry\src\github.com-1ecc6299db9ec823\ndarray-0.15.4\src\data_traits.rs:518:18
|
518 | pub unsafe trait DataOwned: Data {
| --------- required by a bound in this
...
521 | + RawDataSubst<Self::Elem, Output=Self>;
| ------------------------------------- required by this bound in data_traits::DataOwned
|
help: consider further restricting the associated type
|
406 | fn not(mut self) -> Self where ::MaybeUninit: RawDataSubst {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^