-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
Maturin sdist Generation Fails When Using --no-isolation #2245
Comments
I just tried reproducing this with the
As you can see in the output above, the Python executable was resolved to @paddonizio is there something else I'm missing here to reproduce it? |
I was just testing out my fix and realized the same thing. Upon further investigation, I think the one additional piece is that |
Thanks, I was able to reproduce it now by removing the When building an sdist, the I think |
Thanks for your input. I put up a PR with your thoughts as it made sense to me. Upon looking though, I don't actually see where interpreter is even used for sdist generation, though I could have missed something. Either way, I tested this candidate on my local system and it worked. Let me know your thoughts. |
Actually, that's a very good point, maybe there is no real need for the interpreter at all on this code path and the right thing to do would be to simply side step the interpreter detection when building an sdist? That would probably require making the interpreter an optional field of |
Bug Description
Hello,
I have been working on getting Rust builds with maturin in our company's build system. This system isolates builds in an environment already and then runs
sys.executable -m build --sdist --outdir=<staging dir> --no-isolation
. Maturin then fails withFound pyo3 bindings 💥 maturin failed Caused by: Invalid python interpreter version
.I traced this issue to https://github.com/PyO3/maturin/blob/main/src/build_options.rs#L1206. Here, maturin calls
python_ver.split_once('.')...
. However, in a no-isolation situation, for sdist generation, maturin gets the python interpreter fromtarget.get_python
. This will returnpython3
for non-venv linux systems. Ifpython3
is not available on the system, either because the symlink doesn't exist or because it isn't in the system PATH, maturin callsfind_interpreter_in_sysconfig
, which has the aforementionedpython_ver.split_once('.')
. When we try tosplit_once
on that, it fails.I'm happy to put up a fix for this if I can get some guidance on what the proper fix should be. We could first check for just a major version for example and go from there if that would work downstream.
Our build system is quite complicated, but I can reproduce this locally as well and with multiple python versions.
Your maturin version (
maturin --version
)1.7.4
Your Python version (
python -V
)3.12
Your pip version (
pip -V
)23.2.1
What bindings you're using
pyo3
Does
cargo build
work?If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash
/
)?Steps to Reproduce
python3.12 -m build --sdist --no-isolation .
The text was updated successfully, but these errors were encountered: