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

DeprecationWarning: numpy.core.multiarray is deprecated and has been renamed to numpy._core.multiarray. #454

Closed
kahojyun opened this issue Oct 8, 2024 · 1 comment · Fixed by #458

Comments

@kahojyun
Copy link

kahojyun commented Oct 8, 2024

I tried using the newest numpy crate from git which has added numpy 2 support, but calling function using PyArrayLike2 produced the following DeprecationWarning:

DeprecationWarning: numpy.core.multiarray is deprecated and has been renamed to numpy._core.multiarray. The numpy._core namespace contains private NumPy internals and its use is discouraged, as NumPy internals can change without warning in any release. In practice, most real-world usage of numpy.core is to access functionality in the public NumPy API. If that is the case, use the public NumPy API. If not, you are using NumPy internals. If you would still like to access an internal attribute, use numpy._core.multiarray.asarray.

Cargo dependency:

numpy = { git = "https://github.com/PyO3/rust-numpy.git", rev = "ca3299f" }

Test function:

#[pyfunction]
fn calculate(arr: PyArrayLike2<f64>) -> f64 {
    arr.as_array().iter().sum()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants