Skip to content

Conversation

@ngoldbaum
Copy link
Contributor

Updates the PyO3 dependency in the python_ext crate to 0.27.1. Thankfully all the deprecations triggered in the update are trivial to fix.

This also fixes installing llguidance on the free-threaded build of Python 3.14. Free-threaded Python doesn't support abi3, so the existing wheels on PyPI don't work:

goldbaum at Nathans-MBP in ~/Documents/llguidance on main
± python -m pip install llguidance
Collecting llguidance
  Downloading llguidance-1.3.0.tar.gz (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 11.1 MB/s  0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: llguidance
  Building wheel for llguidance (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for llguidance (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [100 lines of output]
      Running `maturin pep517 build-wheel -i /Users/goldbaum/.pyenv/versions/3.14.0t/bin/python --compatibility off`
      📦 Including license file `LICENSE`
      🍹 Building a mixed python/rust project
      🔗 Found pyo3 bindings with abi3 support
      🐍 Found CPython 3.14t at /Users/goldbaum/.pyenv/versions/3.14.0t/bin/python
      📡 Using build options profile, bindings from pyproject.toml
      ⚠️ Warning: CPython 3.14t at /Users/goldbaum/.pyenv/versions/3.14.0t/bin/python does not yet support abi3 so the build artifacts will be version-specific.
      💻 Using `MACOSX_DEPLOYMENT_TARGET=11.0` for aarch64-apple-darwin by default
         Compiling proc-macro2 v1.0.95
         Compiling unicode-ident v1.0.18
         Compiling libc v0.2.174
         Compiling memchr v2.7.5
         Compiling serde v1.0.219
         Compiling target-lexicon v0.13.2
         Compiling cfg-if v1.0.1
         Compiling getrandom v0.3.3
         Compiling regex-syntax v0.8.5
         Compiling once_cell v1.21.3
         Compiling zerocopy v0.8.26
         Compiling autocfg v1.5.0
         Compiling rustversion v1.0.21
         Compiling crossbeam-utils v0.8.21
         Compiling aho-corasick v1.1.3
         Compiling hashbrown v0.15.4
         Compiling anyhow v1.0.98
         Compiling fnv v1.0.7
         Compiling ryu v1.0.20
         Compiling pyo3-build-config v0.24.2
         Compiling regex-automata v0.4.9
         Compiling itoa v1.0.15
         Compiling version_check v0.9.5
         Compiling equivalent v1.0.2
         Compiling strsim v0.11.1
         Compiling serde_json v1.0.140
         Compiling quote v1.0.40
         Compiling ident_case v1.0.1
         Compiling ahash v0.8.12
         Compiling syn v2.0.104
         Compiling indexmap v2.10.0
         Compiling crossbeam-epoch v0.9.18
         Compiling heck v0.5.0
         Compiling rayon-core v1.12.1
         Compiling smallvec v1.15.1
         Compiling crossbeam-deque v0.8.6
         Compiling either v1.15.0
         Compiling lock_api v0.4.13
         Compiling ref-cast v1.0.24
         Compiling parking_lot_core v0.9.11
         Compiling bytemuck v1.23.1
         Compiling paste v1.0.15
         Compiling pyo3-macros-backend v0.24.2
         Compiling pyo3-ffi v0.24.2
         Compiling ppv-lite86 v0.2.21
         Compiling rand_core v0.9.3
         Compiling rayon v1.10.0
         Compiling bit-vec v0.6.3
         Compiling minimal-lexical v0.2.1
         Compiling scopeguard v1.2.0
         Compiling esaxx-rs v0.1.10
         Compiling thiserror v2.0.12
         Compiling bit-vec v0.8.0
         Compiling nom v7.1.3
         Compiling bit-set v0.8.0
         Compiling bit-set v0.5.3
         Compiling rand_chacha v0.9.0
      error: failed to run custom build command for `pyo3-ffi v0.24.2`

      Caused by:
        process didn't exit successfully: `/private/var/folders/nk/yds4mlh97kg9qdq745g715rw0000gn/T/pip-install-0cuz2k_b/llguidance_1e3521a16a5746a6b5c65bcc904e07fb/target/release/build/pyo3-ffi-2caf68f7c391b5d4/build-script-build` (exit status: 1)
        --- stdout
        cargo:rustc-check-cfg=cfg(Py_LIMITED_API)
        cargo:rustc-check-cfg=cfg(Py_GIL_DISABLED)
        cargo:rustc-check-cfg=cfg(PyPy)
        cargo:rustc-check-cfg=cfg(GraalPy)
        cargo:rustc-check-cfg=cfg(py_sys_config, values("Py_DEBUG", "Py_REF_DEBUG", "Py_TRACE_REFS", "COUNT_ALLOCS"))
        cargo:rustc-check-cfg=cfg(pyo3_disable_reference_pool)
        cargo:rustc-check-cfg=cfg(pyo3_leak_on_drop_without_reference_pool)
        cargo:rustc-check-cfg=cfg(Py_3_7)
        cargo:rustc-check-cfg=cfg(Py_3_8)
        cargo:rustc-check-cfg=cfg(Py_3_9)
        cargo:rustc-check-cfg=cfg(Py_3_10)
        cargo:rustc-check-cfg=cfg(Py_3_11)
        cargo:rustc-check-cfg=cfg(Py_3_12)
        cargo:rustc-check-cfg=cfg(Py_3_13)
        cargo:rustc-check-cfg=cfg(Py_3_14)
        cargo:rerun-if-env-changed=PYO3_CROSS
        cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION
        cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG

        --- stderr
        error: The configured Python interpreter version (3.14) is newer than PyO3's maximum supported version (3.13)
        = help: please check if an updated version of PyO3 is available. Current version: 0.24.2
        = help: The free-threaded build of CPython does not support the limited API so this check cannot be suppressed.
      warning: build failed, waiting for other jobs to finish...
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO MACOSX_DEPLOYMENT_TARGET="11.0" PYO3_BUILD_EXTENSION_MODULE="1" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.14-64bit" PYO3_PYTHON="/Users/goldbaum/.pyenv/versions/3.14.0t/bin/python" PYTHON_SYS_EXECUTABLE="/Users/goldbaum/.pyenv/versions/3.14.0t/bin/python" "cargo" "rustc" "--profile" "release" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/var/folders/nk/yds4mlh97kg9qdq745g715rw0000gn/T/pip-install-0cuz2k_b/llguidance_1e3521a16a5746a6b5c65bcc904e07fb/python_ext/Cargo.toml" "--lib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/llguidance._lib.abi3.so"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/Users/goldbaum/.pyenv/versions/3.14.0t/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llguidance
Failed to build llguidance

[notice] A new release of pip is available: 25.2 -> 25.3
[notice] To update, run: pip install --upgrade pip
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> llguidance

It'd also be really nice to get a release out with this change because it would fix building this project on 3.14t and unblock the possibility of releasing wheels that support Python 3.14t.

This would ultimately partially unblock vLLM adding support for the free-threaded build: vllm-project/vllm#28762.

@hudson-ai hudson-ai merged commit ebeef00 into guidance-ai:main Nov 18, 2025
4 checks passed
@ngoldbaum
Copy link
Contributor Author

Thanks for fixing the failing test!

@ngoldbaum
Copy link
Contributor Author

@hudson-ai would it be alright to also update the pin in guidance to point to llguidance 1.4.0 instead of 1.1.0? That would let me add a 3.14t testing job for your CI.

When I tried to do that on my fork of llguidance, the tests failed because the CI installs guidance before building llguidance, and that tries to build llguidance 1.1.0.

I could also restructure the CI, but updating the pin seemed simplest. I'm not sure if the 1.1.0 pin is set in stone.

@hudson-ai
Copy link
Contributor

@ngoldbaum I actually just noticed myself how far behind that was -- yes, let me go update that pin!

@hudson-ai
Copy link
Contributor

@ngoldbaum should be good now -- let me know if you hit any other blocks!

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 this pull request may close these issues.

2 participants