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

error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported #1960

Closed
jeertmans opened this issue Feb 25, 2024 · 14 comments · Fixed by #1964

Comments

@jeertmans
Copy link

Hello,

Two days ago, my CI suddenly started to fail, and it seems to be caused by the
build command from the maturin action:

...
🐍 Found CPython 3.9, CPython 3.10, CPython 3.11, CPython 3.12, CPython 3.13, PyPy 3.9, PyPy 3.10
...
📦 Built wheel for CPython 3.12 to dist/DiffeRT-0.0.8-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
   Compiling pyo3-build-config v0.20.3
   Compiling pyo3-macros-backend v0.20.3
   Compiling pyo3-ffi v0.20.3
   Compiling pyo3 v0.20.3
error: failed to run custom build command for `pyo3-ffi v0.20.3`

Caused by:
  process didn't exit successfully: `/home/runner/work/DiffeRT/DiffeRT/target/release/build/pyo3-ffi-e115a4a9047a20ae/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG
  cargo:rerun-if-env-changed=PYO3_USE_ABI3_FORWARD_COMPATIBILITY

  --- stderr
  error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
  = help: please check if an updated version of PyO3 is available. Current version: 0.20.3
  = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
warning: build failed, waiting for other jobs to finish...
💥 maturin failed
  Caused by: Failed to build a native library through cargo

My CI setup is mostly the same as you provide, see https://github.com/jeertmans/DiffeRT/actions/runs/8039642162/workflow#L16-L43

Any idea how to fix this? I haven't found any similar issue on the web :/

I guess this issue is finding CPython3.13, but should be skipped I guess if unsupported?

@messense
Copy link
Member

This is due to PyO3/pyo3#3821, consider commit your Cargo.lock to avoid such breakage.

@messense messense transferred this issue from PyO3/maturin-action Feb 26, 2024
@messense messense pinned this issue Feb 27, 2024
jeertmans added a commit to jeertmans/DiffeRT that referenced this issue Feb 27, 2024
Add Cargo.lock as recommended by PyO3/maturin#1960 (comment).

Maybe this will be worth removing once Maturin>1.4.0 is released.
@jeertmans
Copy link
Author

This is due to PyO3/pyo3#3821, consider commit your Cargo.lock to avoid such breakage.

Should I also pin to a specific version? Because just committing Cargo.lock didn't fix: jeertmans/DiffeRT#56 (or directly https://github.com/jeertmans/DiffeRT/actions/runs/8062290415/job/22021733511?pr=56).

@messense
Copy link
Member

Should I also pin to a specific version?

Yeah, pin to pyo3 <= 0.20.2, generating the lock file now will update to 0.20.3 which contains the version check.

Generally speaking, you should commit Cargo.lock for reproducibility.

@jeertmans
Copy link
Author

jeertmans commented Feb 27, 2024

Should I also pin to a specific version?

Yeah, pin to pyo3 <= 0.20.2, generating the lock file now will update to 0.20.3 which contains the version check.

Thanks, it now works!

Generally speaking, you should commit Cargo.lock for reproducibility.

I generally do, but I thought it was not so important for this project, so I removed it to "clean a bit the repo", but I get it serves some purposes.

jeertmans added a commit to jeertmans/DiffeRT that referenced this issue Feb 27, 2024
* fix(ci): build issue

Add Cargo.lock as recommended by PyO3/maturin#1960 (comment).

Maybe this will be worth removing once Maturin>1.4.0 is released.

* chore(deps): downgrade to pyo3 <= 0.20.2

* fix(tests): floating point issue
@davidhewitt
Copy link
Member

@jeertmans as a late follow-up here, the point of the PyO3 change is to protect people from shipping builds which might be horribly broken due to lack of support.

I would recommend un-pinning PyO3 and instead set the environment variable PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 like the error message suggests.

If the build doesn't succeed with that environment variable set, then either:

  • PyO3 has a bug or some functionality missing with abi3, please report that as a PyO3 issue
  • The fact you have a successful build at the moment suggests that your 3.13 alpha build is at risk of being broken as soon as a newer alpha comes along.

@davidhewitt
Copy link
Member

@messense maybe in maturin-action we should try to be smart about whether to find 3.13 alpha releases? It is probably not a good idea to be uploading alpha wheels to PyPI unless they are using abi3 only...

jeertmans added a commit to jeertmans/DiffeRT that referenced this issue Feb 29, 2024
@jeertmans
Copy link
Author

@jeertmans as a late follow-up here, the point of the PyO3 change is to protect people from shipping builds which might be horribly broken due to lack of support.

I would recommend un-pinning PyO3 and instead set the environment variable PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 like the error message suggests.

If the build doesn't succeed with that environment variable set, then either:

  • PyO3 has a bug or some functionality missing with abi3, please report that as a PyO3 issue
  • The fact you have a successful build at the moment suggests that your 3.13 alpha build is at risk of being broken as soon as a newer alpha comes along.

@davidhewitt thanks for the clarification! Looks like this also fixes the previous issues, see jeertmans/DiffeRT#59. I would tend to prefer this fix over the above one, as I do not need to restrict the pyo3 version with this one :-)

jeertmans added a commit to jeertmans/DiffeRT that referenced this issue Feb 29, 2024
sd2k added a commit to grafana/augurs that referenced this issue Feb 29, 2024
Builds are currently failing because the maturin action is attempting to
build the wheel for every Python interpreter in the linux job. This
includes an alpha version of 3.13, but since 0.20.3 pyo3 will refuse to
build for that version of Python because forward-compatibility with
future 3.13 versions isn't guaranteed. We've also ended up with some
3.13 versions of augurs on PyPI :(

This commit restricts the versions to 3.7 - 3.12, the currently
supported versions of Python.

In future it's possible that maturin will allow us to only include
non-alpha/beta versions of Python with the '--find-interpreter' flag,
but until then we'll need to update them manually.

Relevant issue: PyO3/maturin#1960
sd2k added a commit to grafana/augurs that referenced this issue Feb 29, 2024
Builds are currently failing because the maturin action is attempting to
build the wheel for every Python interpreter in the linux job. This
includes an alpha version of 3.13, but since 0.20.3 pyo3 will refuse to
build for that version of Python because forward-compatibility with
future 3.13 versions isn't guaranteed. We've also ended up with some
3.13 versions of augurs on PyPI :(

This commit restricts the versions to 3.7 - 3.12, the currently
supported versions of Python.

In future it's possible that maturin will allow us to only include
non-alpha/beta versions of Python with the '--find-interpreter' flag,
but until then we'll need to update them manually.

Relevant issue: PyO3/maturin#1960
@victorteokw
Copy link

What should we update to the CI yaml?

@davidhewitt
Copy link
Member

I believe that maturin 1.5 no longer detects 3.13, so maybe start by retrying?

@victorteokw
Copy link

Thanks @davidhewitt

@jeertmans
Copy link
Author

I believe that maturin 1.5 no longer detects 3.13, so maybe start by retrying?

Didn’t see it was released! It now works without the environ variable trick: jeertmans/DiffeRT#67.

Thank you!

jeertmans added a commit to jeertmans/DiffeRT that referenced this issue Mar 10, 2024
@victorteokw
Copy link

Screenshot 2024-03-18 at 20 42 50 This problem still exists. It tries to find Python 3.13 only on this system like before.

@davidhewitt
Copy link
Member

@victorteokw can you share job logs?

@victorteokw
Copy link

Hi @davidhewitt, sorry about this. I forgot to upgrade Maturin. Maturin 1.5 and pyo3 0.20.3 works fine.

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.

4 participants