Skip to content

Build fails on Python 3.14.0b1 #569

@bastimeyer

Description

@bastimeyer

orjson supports CPython 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14.

Building orjson ==3.10.18 from its sdist (or from git) on Python 3.14.0b1 fails, and there are no matching cp314-cp314 wheels available on PyPI.

Python 3.14 has entered its beta stage a few days ago (2025-05-07), which means it's now feature- and ABI-locked:
https://peps.python.org/pep-0745/#schedule

orjson is a dependency of mypy[faster-cache], which is why I've encountered this issue.

$ uname -mrs
Linux 6.14.4-2-git x86_64

$ python -V
Python 3.14.0b1

$ pip install orjson
Collecting orjson
  Using cached orjson-3.10.18.tar.gz (5.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: orjson
  Building wheel for orjson (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for orjson (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [79 lines of output]
      Running `maturin pep517 build-wheel -i /home/basti/venv/orjson/bin/python3.14 --compatibility off`
      📦 Including license file "/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/LICENSE-APACHE"
      📦 Including license file "/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/LICENSE-MIT"
      🍹 Building a mixed python/rust project
      🔗 Found pyo3-ffi bindings
      🐍 Found CPython 3.14 at /home/basti/venv/orjson/bin/python3.14
         Compiling target-lexicon v0.13.2
         Compiling proc-macro2 v1.0.95
         Compiling unicode-ident v1.0.18
         Compiling once_cell v1.21.3
         Compiling rustversion v1.0.20
         Compiling serde v1.0.219
         Compiling cfg-if v1.0.0
         Compiling shlex v1.3.0
         Compiling libc v0.2.172
         Compiling ryu v1.0.20
         Compiling itoa v1.0.15
         Compiling version_check v0.9.5
         Compiling serde_json v1.0.140
         Compiling static_assertions v1.1.0
         Compiling memchr v2.7.4
         Compiling itoap v1.0.1
         Compiling smallvec v1.15.0
         Compiling associative-cache v2.0.0
         Compiling xxhash-rust v0.8.15
         Compiling bytecount v0.6.8
         Compiling jiff v0.2.10
         Compiling simdutf8 v0.1.5
         Compiling uuid v1.16.0
         Compiling encoding_rs v0.8.35
         Compiling half v2.6.0
         Compiling cc v1.2.20
         Compiling castaway v0.2.3
         Compiling pyo3-build-config v0.23.3 (/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/include/pyo3/pyo3-build-config)
         Compiling quote v1.0.40
         Compiling syn v2.0.101
         Compiling pyo3-ffi v0.23.3 (/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/include/pyo3/pyo3-ffi)
         Compiling orjson v3.10.18 (/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360)
      error: failed to run custom build command for `pyo3-ffi v0.23.3 (/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/include/pyo3/pyo3-ffi)`
      
      Caused by:
        process didn't exit successfully: `/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/target/release/build/pyo3-ffi-08e5cb51b71bd02e/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(invalid_from_utf8_lint)
        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(diagnostic_namespace)
        cargo:rustc-check-cfg=cfg(c_str_lit)
        cargo:rustc-check-cfg=cfg(rustc_has_once_lock)
        cargo:rustc-check-cfg=cfg(io_error_more)
        cargo:rustc-check-cfg=cfg(fn_ptr_eq)
        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: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
        cargo:rerun-if-env-changed=PYO3_USE_ABI3_FORWARD_COMPATIBILITY
      
        --- 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.23.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
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.14-64bit" PYO3_PYTHON="/home/basti/venv/orjson/bin/python3.14" PYTHON_SYS_EXECUTABLE="/home/basti/venv/orjson/bin/python3.14" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/Cargo.toml" "--release" "--lib"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/home/basti/venv/orjson/bin/python3.14', '--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 orjson
Failed to build orjson
ERROR: Failed to build installable wheels for some pyproject.toml based projects (orjson)
error: failed to run custom build command for `pyo3-ffi v0.23.3 (/tmp/pip-install-5andpuvz/orjson_6952dc82b66b4376a5d1078c1a0f7360/include/pyo3/pyo3-ffi)`
error: the configured Python interpreter version (3.14) is newer than PyO3's maximum supported version (3.13)

The issue comes from the vendored pyo3-ffi ==0.23.3 dependency:
https://github.com/ijl/orjson/blob/3.10.18/include/pyo3/pyo3-ffi/Cargo.toml

Building with the PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 env var set also fails:

...
      error[E0412]: cannot find type `c_void` in this scope
        --> include/pyo3/pyo3-ffi/src/pyhash.rs:19:38
         |
      19 |     pub fn Py_HashBuffer(ptr: *const c_void, len: Py_ssize_t) -> Py_hash_t;
         |                                      ^^^^^^ not found in this scope
         |
      help: consider importing one of these items
         |
      8  + use std::ffi::c_void;
         |
      8  + use std::os::raw::c_void;
         |
      8  + use core::ffi::c_void;
         |
      8  + use libc::c_void;
         |
      
      error[E0412]: cannot find type `Py_ssize_t` in this scope
        --> include/pyo3/pyo3-ffi/src/pyhash.rs:19:51
         |
      19 |     pub fn Py_HashBuffer(ptr: *const c_void, len: Py_ssize_t) -> Py_hash_t;
         |                                                   ^^^^^^^^^^ not found in this scope
         |
      help: consider importing this type alias through its public re-export
         |
      8  + use crate::Py_ssize_t;
         |
      
      error[E0412]: cannot find type `Py_hash_t` in this scope
        --> include/pyo3/pyo3-ffi/src/pyhash.rs:19:66
         |
      19 |     pub fn Py_HashBuffer(ptr: *const c_void, len: Py_ssize_t) -> Py_hash_t;
         |                                                                  ^^^^^^^^^ not found in this scope
         |
      help: consider importing this type alias through its public re-export
         |
      8  + use crate::Py_hash_t;
         |
      
      For more information about this error, try `rustc --explain E0412`.
      error: could not compile `pyo3-ffi` (lib) due to 3 previous errors
...

Here's the upstream issue for 0.25 which intends to add support for Python 3.14:
PyO3/pyo3#5107

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions