Setting the target python version - confusion around PYO3_PYTHON and --interpreter parameter #5016
Unanswered
dantliff-sqc
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a Python extension as a wheel and I want to target Python 3.10, although I have Python 3.12 installed on the build host, on Linux (Ubuntu 24.04). I'm not using ABI3. I'm using PyO3 v0.24.0 with
pyo3
bindings, thegenerate-import-lib
feature, andcrate-type = ["cdylib"]
.Off the bat, maturin targets Python 3.12:
So that seems to have picked up Python 3.12, and if I remove
PYO3_PRINT_CONFIG
then it creates-cp312-cp312-linux_x86_64.whl
, as expected.According to Configuring the Python version, I should be able to set
PYO3_PYTHON=python3.10
, to change the wheel target version, however:It seemed to have had no effect.
There's a parameter to maturin called
--interpreter
which has very little documentation (that I can find). The best I can find is:This option is not mentioned in Building and distribution at all, and only briefly mentioned in maturin docs as well, with no additional information.
However, it seems to be necessary in this case:
I can then take that
-cp310-
wheel and copy it to a Linux machine with Python 3.10 and it works, whereas the-cp312-
one wouldn't because pip under 3.10 would reject it as incompatible.What I'm really not clear about is whether this is working as intended. There's so little documentation about this
--interpreter
option, andPYO3_PYTHON=python3.10
seems to have no effect, that I'm not sure I'm going about this the right way.In what cases would
PYO3_PYTHON=python3.10
work? Does python3.10 need to be in thePATH
?Beta Was this translation helpful? Give feedback.
All reactions