fix(ci): cap torch <2.3 on Python 3.9 so poetry resolves (#101)#104
fix(ci): cap torch <2.3 on Python 3.9 so poetry resolves (#101)#104jhamon wants to merge 3 commits into
Conversation
The unbounded `torch >=1.13.1` constraint no longer resolves on Python 3.9: torch >=2.3 pulls a triton/setuptools chain that requires Python >=3.10, so Poetry cannot find a torch satisfying the graph on 3.9 and version solving fails. This reddened the `Run tests (ubuntu-latest, 3.9)` cell on every PR. Split torch into per-Python constraints — cap to <2.3 on Python <3.10 (torch 2.2.2 has 3.9 wheels), keep the open range on >=3.10. Non-breaking: preserves the existing 3.9 support matrix rather than dropping it. Verified locally with `poetry check` (All set!) and `poetry lock` (resolves; previously failed). Fixes #101 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update: the torch<2.3 cap resolves Poetry but does not make CI green — this path is a dead endLatest CI on this branch (run 29449063794):
The cap traded a resolve-time failure for run-time failures. Two independent root causes, both intrinsic to pinning py3.9 onto old torch:
The contradiction is fatal: linux-3.9 can only resolve with torch < 2.3 (the Recommendation: abandon the cap-torch approach and take issue #101 option 1 — drop Python 3.9 from the support matrix and CI. Python 3.9 reached end-of-life on 2025-10-31; the modern ML stack (transformers requiring torch≥2.6, NumPy 2.x) no longer supports it cleanly. That is a user-facing support-matrix change, so it needs maintainer/owner sign-off rather than being shipped from an autofix pass. Converting this PR to draft so it isn't merged as-is. Tracking the decision on #101. |
Capping torch <2.3 on Python 3.9 (previous commit) fixed dependency resolution but surfaced a runtime failure: torch 2.2.2 is built against the numpy 1.x ABI and raises "RuntimeError: Numpy is not available" during SentenceTransformer.encode when numpy 2.x is installed. The unbounded `numpy >=1.21.5` constraint let Poetry pull numpy 2.x on 3.9. Split numpy into per-Python constraints mirroring torch: cap <2 on Python <3.10 (resolves to numpy 1.26.4, the last 1.x line with 3.9 wheels), keep the open range on >=3.10 where torch >=2.3 supports numpy 2.x. Non-breaking. Verified: `poetry check` (All set!) and `poetry lock` now resolve numpy 1.26.4 for the python<3.10 marker and 2.2.6 for >=3.10. Fixes #101 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed Fix mirrors the torch split: cap Verified locally: |
transformers >=4.49 gates torch.load behind torch >=2.6 (CVE-2025-32434 mitigation). Python 3.9 is already capped at torch <2.3, so loading a SPLADE model that ships as pytorch_model.bin raises at runtime on macos/windows 3.9 (ubuntu happened to fetch a .safetensors variant and passed). Capping transformers <4.49 on Python <3.10 removes the gate and makes the load deterministic across all platforms; poetry locks 4.48.3 there and 4.57.6 on >=3.10. Verified: transformers 4.48.3 has no torch>=2.6 gate (present from 4.49.0); `poetry lock` resolves 4.48.3 for py<3.10 + torch 2.2.2. Refs #101 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed What the numpy fix (
Root cause: Fix: cap Verified (not push-and-pray):
|
|
I think the correct thing to do here is actually to remove python 3.9 as it is EOL |
What
Splits the
torchoptional dependency into per-Python constraints so Poetry can resolve the dependency graph on Python 3.9:Why
The
Run tests (ubuntu-latest, 3.9)matrix cell fails atpoetry installon every PR (pre-existing, environmental). Root cause: the unboundedtorch >=1.13.1constraint. torch ≥2.3 pulls atriton → setuptools (>=40.8.0, py>=3.10)chain, so no torch version satisfies the graph on Python 3.9 → version solving fails.Capping torch to
<2.3on Python<3.10(torch 2.2.2 ships 3.9 wheels) keeps 3.9 resolvable while leaving 3.10+ on the open range.Non-breaking
Preserves the existing
python = ">=3.9,<4.0"support matrix rather than dropping 3.9. Dropping 3.9 (issue #101 option 1) remains a separate support-matrix decision for the maintainers; this change unblocks CI without pre-empting it.Verification
Local, mirroring what CI does (repo doesn't commit
poetry.lock; CI re-resolves viapoetry install):poetry check→All set!poetry lock→ resolves and writes lock (torch 2.2.2 for py<3.10, newer for py≥3.10). The same command failed withversion solving failedbefore this change.Fixes #101.
🤖 Generated with Claude Code
Note
Low Risk
Packaging-only change in
pyproject.tomlwith no application code changes; main effect is which torch versions Poetry can select on Python 3.9.Overview
Replaces the single optional
torch >=1.13.1constraint with Python-specific markers so Poetry can resolve installs on 3.9:>=1.13.1,<2.3whenpython < 3.10, and the previous open lower bound on 3.10+.This addresses CI failures on the 3.9 matrix job (
poetry installwith--all-extras), where torch ≥2.3 pulls dependencies that require Python ≥3.10, making version solving impossible. 3.9 users who opt into torch extras are effectively capped at 2.2.x (still within>=1.13.1); behavior on newer Python versions is unchanged.Reviewed by Cursor Bugbot for commit b08f703. Bugbot is set up for automated code reviews on this repo. Configure here.