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

Optionally disable pyo3/auto-initialize? #174

Closed
dovahcrow opened this issue Feb 23, 2021 · 4 comments
Closed

Optionally disable pyo3/auto-initialize? #174

dovahcrow opened this issue Feb 23, 2021 · 4 comments

Comments

@dovahcrow
Copy link

dovahcrow commented Feb 23, 2021

Currently, it is not possible to use rust-numpy with cargo test, due to the issue mentioned here https://pyo3.rs/v0.13.1/faq.html#i-cant-run-cargo-test-im-having-linker-issues-like-symbol-not-found-or-undefined-reference-to-_pyexc_systemerror.

This is because even one disables the corresponding auto-initialize feature for pyo3, rust-numpy still enables it.

A workaround is in my fork at here, which adds a pyo3-default feature to control the pyo3 features.

Basically, one can use the method included in the FAQ, along with adding default-features = false to the numpy crate to allow a project to run the tests successfully.

I can create a PR if you guys think this solution is acceptable.

@dovahcrow
Copy link
Author

Also, I feel like rust-numpy does not require the auto-initialize feature anyway. So it might possible to just disable these unused default pyo3 features.

@kngwyu
Copy link
Member

kngwyu commented Feb 23, 2021

Thanks for reporting.

Doesn't the below workaround work?

[dependencies.pyo3]
version = "0.13"
default-features = false
features = ["extension-module"]

Also, I feel like rust-numpy does not require the auto-initialize feature anyway. So it might possible to just disable these unused default pyo3 features.

That's worth considering. Actually, those features were not optional until recently.

@kngwyu
Copy link
Member

kngwyu commented Feb 23, 2021

Ah, but I noticed that auto-initialize would be removed: PyO3/pyo3#1443

@dovahcrow
Copy link
Author

@kngwyu Yep, I saw that issue just now. I think we can just wait for the upstream.

Feel free to close this issue.

@kngwyu kngwyu closed this as completed Jul 10, 2021
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

No branches or pull requests

2 participants