outlines-core icon indicating copy to clipboard operation
outlines-core copied to clipboard

Support Python 3.14

Open robinvandernoord opened this issue 1 month ago • 3 comments

I've updated the required dependencies (pyo3 and serde-pyobject) to versions that support Python 3.14. This caused a compilation error when building, which I've fixed in src/python_bindings/mod.rs by adding a type hint. Furthermore, I've added 3.14 as a build target in the build_wheels.yml github workflow.

Running make test still failed on 4 tests:

FAILED tests/test_kernels.py::test_interface_torch - RuntimeError: torch.compile is not supported on Python 3.14+
FAILED tests/test_kernels.py::test_interface_numpy - ImportError: To use the kernels in `outlines_core.kernels.numpy`, `numba` must be installed. You can install it with `pip install numba`
FAILED tests/test_kernels.py::test_torch_correctness - RuntimeError: torch.compile is not supported on Python 3.14+
FAILED tests/test_kernels.py::test_numpy_correctness - ImportError: To use the kernels in `outlines_core.kernels.numpy`, `numba` must be installed. You can install it with `pip install numba`

This is due to numba not supporting 3.14 and torch only partially supporting it.

robinvandernoord avatar Oct 31 '25 11:10 robinvandernoord

Installing latest numba via (uv) pip install git+https://github.com/numba/numba.git reduces the amount of errors to 2:

FAILED tests/test_kernels.py::test_interface_torch - RuntimeError: torch.compile is not supported on Python 3.14+
FAILED tests/test_kernels.py::test_torch_correctness - RuntimeError: torch.compile is not supported on Python 3.14+

This error is still raised on the latest main branch of torch: https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/eval_frame.py#L1306

robinvandernoord avatar Oct 31 '25 11:10 robinvandernoord

@robinvandernoord maybe it makes sense to split out the pyo3 update into its own PR? That would at least make the main branch buildable on Python 3.14.

ngoldbaum avatar Nov 18 '25 19:11 ngoldbaum

@ngoldbaum you mean commit https://github.com/dottxt-ai/outlines-core/pull/235/commits/aed9c3e969d93e8cb87911d944df93641ea97e23 without the change in GitHub actions?

Yes I think that does make sense. I'll update from the main branch, apply the patch and make a new PR!

robinvandernoord avatar Nov 18 '25 19:11 robinvandernoord