Skip to content

fix(ci): unbreak master CI (pyarrow 26, torch weights_only, pandas 3, leptonai 0.47) - #3477

Merged
pingsutw merged 3 commits into
masterfrom
kevin/ci-pyarrow-torch
Oct 24, 2026
Merged

pingsutw merged 3 commits into
masterfrom
kevin/ci-pyarrow-torch

Conversation

@pingsutw

@pingsutw pingsutw commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Tracking issue

N/A — master CI has been red since the last green run on 2026-10-02 (run 37051324786) due to upstream releases, not repo changes.

Why are the changes needed?

Every Build run on master currently fails for several independent upstream reasons:

  1. pyarrow 26.0.0 (released 2026-10-09) requires numpy>=2. dev-requirements.in leaves pyarrow unpinned, while tensorflow<=2.15.1 forces numpy 1.26.4. The test-serialization, build-with-pandas and both integration jobs die at collection time with:
    ImportError: pyarrow requires NumPy 2.0 or newer, found 1.26.4
    
  2. torch>=2.6 defaults torch.load(weights_only=True), which refuses to unpickle nn.Module objects. All four build-with-extras jobs fail test_native.py::test_wf and test_transformations.py::test_to_python_value_and_literal[...PyTorchModule...] with:
    _pickle.UnpicklingError: Weights only load failed. ... Unsupported global: torch.nn.modules.linear.Linear
    
  3. pandas 3.x wheels need numpy>=2.0.2 at import time, but the build-plugins job installs numpy<2.0.0 for the onnx, sqlalchemy and pandera plugins (and whylogs pins numpy<2.0 itself). build-plugins (3.12, ...) for whylogs, pandera, onnx-scikitlearn fail with:
    ImportError: Please upgrade numpy to >= 2.0.2 to use this pandas version.
    
    sqlalchemy fails the same way, surfaced as '_LazyModule' object has no attribute 'DataFrame' because pandas is lazily imported.
  4. leptonai 0.47 (released 2026-10-20) removed leptonai.api.v1, which the dgxc-lepton connector imports:
    ModuleNotFoundError: No module named 'leptonai.api.v1'
    

What changes were proposed in this pull request?

  • dev-requirements.in: pin pyarrow<26 with a comment explaining the tensorflow/numpy conflict. Resolution now picks pyarrow 25.0.1 + numpy 1.26.4 + tensorflow 2.15.1.
  • flytekit/extras/pytorch/native.py: add a TORCH_LOAD_KWARGS class attribute on PyTorchTypeTransformer (empty by default) that is forwarded to torch.load. Only PyTorchModuleTransformer sets {"weights_only": False}, since it pickles a whole nn.Module. The kwarg is only passed when torch supports it (torch<1.13 on py3.10 does not). PyTorchTensorTransformer and PyTorchCheckpointTransformer keep torch's safe default: tensors, state dicts and plain hyperparameter values all load fine with weights_only=True. This restores the pre-torch-2.6 behavior for the module transformer only.
  • plugins/flytekit-{whylogs,pandera,sqlalchemy,onnx-scikitlearn}/dev-requirements.in: pin pandas<3, following the existing scipy<1.18 workaround in onnx-scikitlearn for the same CI numpy<2 forcing.
  • plugins/flytekit-dgxc-lepton/setup.py: pin leptonai<0.47.

Follow-up worth considering (not done here, since it is a CI config change): the numpy<2.0.0 forcing in pythonbuild.yml is commented as an onnx workaround but also applies to sqlalchemy and pandera, which likely no longer need it.

How was this patch tested?

Reproduced locally in an arm64 Python 3.12 venv:

# torch 2.14.1 (what CI installs)
pytest tests/flytekit/unit/extras/pytorch -q   # master: 2 failed, 11 passed; branch: 13 passed

# pandas 2.3.3 + numpy 1.26.4 + pyarrow 25.0.1 (what the pins resolve to)
cd plugins/flytekit-sqlalchemy && pytest tests -q   # 11 passed

# leptonai 0.27.3
cd plugins/flytekit-dgxc-lepton && pytest tests -q  # 23 passed

uv pip install --dry-run --python-version 3.11 -r dev-requirements.in resolves to pyarrow 25.0.1 / numpy 1.26.4 / tensorflow 2.15.1. Dry-run resolution of each pinned plugin with numpy<2.0.0 picks pandas 2.3.3.

No new tests: the existing tests that were failing are the regression tests for these changes.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

pyarrow 26 requires numpy>=2, which tensorflow<=2.15.1 forbids, so every
job that imports pyarrow dies at collection time.

torch>=2.6 defaults torch.load(weights_only=True), which refuses to
unpickle nn.Module objects. Pass weights_only=False when the kwarg exists
(torch<1.13 does not have it).

Signed-off-by: Kevin Su <pingsutw@apache.org>
Tensors and checkpoints (state dicts + plain values) load fine under
torch's safe default, so keep it there and only opt out where a whole
nn.Module is pickled.

Signed-off-by: Kevin Su <pingsutw@apache.org>
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.77%. Comparing base (3fbaf5e) to head (d6614ed).

Files with missing lines Patch % Lines
flytekit/extras/pytorch/native.py 0.00% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (3fbaf5e) and HEAD (d6614ed). Click for more details.

HEAD has 9 uploads less than BASE
Flag BASE (3fbaf5e) HEAD (d6614ed)
10 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3477       +/-   ##
===========================================
- Coverage   80.83%   47.77%   -33.06%     
===========================================
  Files         217      217               
  Lines       22960    22963        +3     
  Branches     3038     3037        -1     
===========================================
- Hits        18559    10970     -7589     
- Misses       3547    11385     +7838     
+ Partials      854      608      -246     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

pandas 3.x wheels need numpy>=2.0.2 at import time, but CI installs
numpy<2 for the onnx, sqlalchemy and pandera plugins (and whylogs pins it
itself). Pin pandas<3 in those plugins' dev requirements, following the
existing scipy<1.18 workaround in onnx-scikitlearn.

leptonai 0.47 removed leptonai.api.v1, which the lepton connector imports.

Signed-off-by: Kevin Su <pingsutw@apache.org>
@pingsutw pingsutw changed the title fix(ci): pin pyarrow<26 and load pickled nn.Module with weights_only=False fix(ci): unbreak master CI (pyarrow 26, torch weights_only, pandas 3, leptonai 0.47) Oct 23, 2026
@pingsutw
pingsutw merged commit 1850e0d into master Oct 24, 2026
57 of 59 checks passed
fellhorn pushed a commit to fellhorn/flytekit that referenced this pull request Oct 25, 2026
- pyproject.toml: requires-python ">=3.10,<3.14", add the 3.13 classifier;
  regenerate uv.lock accordingly.
- PythonVersion enum and default image prefixes: add 3.13 in flytekit
  core, the sqlalchemy plugin and the openai batch plugin. Without it,
  DefaultImages.find_image_for() raises "(3, 13) is not a valid
  PythonVersion" on 3.13.
- CI (pythonbuild.yml): run 3.13 on pull requests and in the nightly
  matrix, enable the extras (tensorflow/pytorch) tests on 3.13, exclude
  pandas<2 and plugins whose dependencies do not support 3.13 yet.
- dev-requirements.in: tensorflow>=2.21 and torch>=2.6 on 3.13; lift the
  protobuf<5 dev pin on 3.13 only (tensorflow 2.21 needs protobuf>=6, and
  the issue behind the pin, flyteorg/flyte#5448, was fixed upstream).
- Publish py3.13 images in pythonpublish.yml and build_image.yml.
- pytorch extras: torch>=2.6 defaults torch.load(weights_only=True), which
  cannot load the whole nn.Module / checkpoint objects flytekit stores.
  Pass weights_only=False where the keyword exists. This is required for
  the extras tests on 3.13 and already fails in the nightly 3.11 run.

Closes flyteorg/flyte#6993

Rebased onto flyteorg#3477: its pytorch weights_only handling replaces the one from this commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: bochinski <30434375+bochinski@users.noreply.github.com>
(cherry picked from commit 605e0b1)
Signed-off-by: Dennis Keck <26092524+fellhorn@users.noreply.github.com>
fellhorn pushed a commit to fellhorn/flytekit that referenced this pull request Oct 25, 2026
- pyproject.toml: requires-python ">=3.10,<3.14", add the 3.13 classifier;
  regenerate uv.lock accordingly.
- PythonVersion enum and default image prefixes: add 3.13 in flytekit
  core, the sqlalchemy plugin and the openai batch plugin. Without it,
  DefaultImages.find_image_for() raises "(3, 13) is not a valid
  PythonVersion" on 3.13.
- CI (pythonbuild.yml): run 3.13 on pull requests and in the nightly
  matrix, enable the extras (tensorflow/pytorch) tests on 3.13, exclude
  pandas<2 and plugins whose dependencies do not support 3.13 yet.
- dev-requirements.in: tensorflow>=2.21 and torch>=2.6 on 3.13; lift the
  protobuf<5 dev pin on 3.13 only (tensorflow 2.21 needs protobuf>=6, and
  the issue behind the pin, flyteorg/flyte#5448, was fixed upstream).
- Publish py3.13 images in pythonpublish.yml and build_image.yml.
- pytorch extras: torch>=2.6 defaults torch.load(weights_only=True), which
  cannot load the whole nn.Module / checkpoint objects flytekit stores.
  Pass weights_only=False where the keyword exists. This is required for
  the extras tests on 3.13 and already fails in the nightly 3.11 run.

Closes flyteorg/flyte#6993

Rebased onto flyteorg#3477: its pytorch weights_only handling replaces the one from this commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: bochinski <30434375+bochinski@users.noreply.github.com>
(cherry picked from commit 605e0b1)
Signed-off-by: Dennis Keck <26092524+fellhorn@users.noreply.github.com>
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