I was trying to build Anki from source on Ubuntu and encountered an issue because I have python 3.14 installed on my system.
Finished `release` profile [optimized] target(s) in 0.34s
failed: pyenv
Resolved 116 packages in 3ms
Building orjson==3.10.18
× Failed to build `orjson==3.10.18`
├─▶ The build backend returned an error
╰─▶ Call to `maturin.build_wheel` failed (exit status: 1)
[stdout]
Running `maturin pep517 build-wheel -i
/home/user/.cache/uv/builds-v0/.tmp2C6lOS/bin/python --compatibility
off`
[stderr]
📦 Including license file `LICENSE-APACHE`
📦 Including license file `LICENSE-MIT`
🍹 Building a mixed python/rust project
🔗 Found pyo3-ffi bindings
🐍 Found CPython 3.14 at
/home/user/.cache/uv/builds-v0/.tmp2C6lOS/bin/python
Compiling pyo3-build-config v0.23.3
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/include/pyo3/pyo3-build-config)
Compiling serde v1.0.219
Compiling itoap v1.0.1
Compiling xxhash-rust v0.8.15
Compiling bytecount v0.6.8
Compiling associative-cache v2.0.0
Compiling uuid v1.16.0
Compiling once_cell v1.21.3
Compiling simdutf8 v0.1.5
Compiling pyo3-ffi v0.23.3
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/include/pyo3/pyo3-ffi)
Compiling orjson v3.10.18
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src)
error: failed to run custom build command for `pyo3-ffi v0.23.3
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/include/pyo3/pyo3-ffi)`
Caused by:
process didn't exit successfully:
`/home/user/GitHub/anki/out/rust/release/build/pyo3-ffi-35383e79d3a7ebd1/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_BUILD_EXTENSION_MODULE="1"
PYO3_ENVIRONMENT_SIGNATURE="cpython-3.14-64bit"
PYO3_PYTHON="/home/user/.cache/uv/builds-v0/.tmp2C6lOS/bin/python"
PYTHON_SYS_EXECUTABLE="/home/user/.cache/uv/builds-v0/.tmp2C6lOS/bin/python"
"cargo" "rustc" "--profile" "release" "--message-format"
"json-render-diagnostics" "--manifest-path"
"/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/Cargo.toml"
"--lib"`
Error: command ['maturin', 'pep517', 'build-wheel', '-i',
'/home/user/.cache/uv/builds-v0/.tmp2C6lOS/bin/python',
'--compatibility', 'off'] returned non-zero exit status 1
hint: This usually indicates a problem with the package or the build
environment.
help: `orjson` (v3.10.18) was included because `anki` depends on `orjson`
Failed to run (1): /home/user/GitHub/anki/out/extracted/uv/uv sync --locked --no-config --all-packages --extra qt --extra audio
Build failed.
Here’s the output of some relevant commands:
which python
/usr/bin/python
python --version
Python 3.13.7
which python3
/home/linuxbrew/.linuxbrew/bin/python3
python3 --version
Python 3.14.0
I solved the issue by uninstalling python 3.14. But, I wonder if there’s a better solution. Also, can the build script of Anki be adjusted so that it can fall back to a supported Python version if a newer Python is also installed on the user’s computer?
help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this
I tried this and got:
user@Ubuntu:~/GitHub/anki$ PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 ./run
Finished `release` profile [optimized] target(s) in 0.75s
failed: pyenv
Resolved 116 packages in 6ms
Building orjson==3.10.18
× Failed to build `orjson==3.10.18`
├─▶ The build backend returned an error
╰─▶ Call to `maturin.build_wheel` failed (exit status: 1)
[stdout]
Running `maturin pep517 build-wheel -i
/home/user/.cache/uv/builds-v0/.tmpB3bHoF/bin/python --compatibility
off`
[stderr]
Blocking waiting for file lock on package cache
📦 Including license file `LICENSE-APACHE`
📦 Including license file `LICENSE-MIT`
🍹 Building a mixed python/rust project
🔗 Found pyo3-ffi bindings
🐍 Found CPython 3.14 at
/home/user/.cache/uv/builds-v0/.tmpB3bHoF/bin/python
Compiling pyo3-build-config v0.23.3
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/include/pyo3/pyo3-build-config)
Compiling pyo3-ffi v0.23.3
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/include/pyo3/pyo3-ffi)
Compiling orjson v3.10.18
(/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src)
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
|
note: found an item that was configured out
--> include/pyo3/pyo3-ffi/src/pyhash.rs:6:19
|
5 | #[cfg(not(any(Py_LIMITED_API, PyPy)))]
| --------------------------- the item is gated here
6 | use std::os::raw::c_void;
| ^^^^^^
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
|
note: found an item that was configured out
--> include/pyo3/pyo3-ffi/src/pyhash.rs:2:32
|
1 | #[cfg(not(any(Py_LIMITED_API, PyPy)))]
| --------------------------- the item is gated here
2 | use crate::pyport::{Py_hash_t, Py_ssize_t};
| ^^^^^^^^^^
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
|
note: found an item that was configured out
--> include/pyo3/pyo3-ffi/src/pyhash.rs:2:21
|
1 | #[cfg(not(any(Py_LIMITED_API, PyPy)))]
| --------------------------- the item is gated here
2 | use crate::pyport::{Py_hash_t, Py_ssize_t};
| ^^^^^^^^^
note: found an item that was configured out
--> include/pyo3/pyo3-ffi/src/setobject.rs:3:20
|
2 | #[cfg(not(any(Py_LIMITED_API, PyPy, GraalPy)))]
| ------------------------------------ the item is gated
here
3 | use crate::pyport::Py_hash_t;
| ^^^^^^^^^
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
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_BUILD_EXTENSION_MODULE="1"
PYO3_ENVIRONMENT_SIGNATURE="cpython-3.14-64bit"
PYO3_PYTHON="/home/user/.cache/uv/builds-v0/.tmpB3bHoF/bin/python"
PYTHON_SYS_EXECUTABLE="/home/user/.cache/uv/builds-v0/.tmpB3bHoF/bin/python"
"cargo" "rustc" "--profile" "release" "--message-format"
"json-render-diagnostics" "--manifest-path"
"/home/user/.cache/uv/sdists-v9/pypi/orjson/3.10.18/1cWAGf-KR0pyLjAQWJxy6/src/Cargo.toml"
"--lib"`
Error: command ['maturin', 'pep517', 'build-wheel', '-i',
'/home/user/.cache/uv/builds-v0/.tmpB3bHoF/bin/python',
'--compatibility', 'off'] returned non-zero exit status 1
hint: This usually indicates a problem with the package or the build
environment.
help: `orjson` (v3.10.18) was included because `anki` depends on `orjson`
Failed to run (1): /home/user/GitHub/anki/out/extracted/uv/uv sync --locked --no-config --all-packages --extra qt --extra audio
Build failed.
Interestingly, the error message says:
Current version: 0.23.3
But, cargo.lock says 0.25.1
user@Ubuntu:~/GitHub/anki$ grep -A 4 'pyo3' Cargo.lock
name = "pyo3"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
dependencies = [
--
name = "pyo3-ffi"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
dependencies = [