Skip to content

scikit-learn: add build-scikit-learn.yml for riscv64 wheels - #339

Open
luhenry wants to merge 4 commits into
mainfrom
scikit-learn
Open

scikit-learn: add build-scikit-learn.yml for riscv64 wheels#339
luhenry wants to merge 4 commits into
mainfrom
scikit-learn

Conversation

@luhenry

@luhenry luhenry commented Aug 25, 2026

Copy link
Copy Markdown
Member

~100 Cython/C++ extension modules. Upstream publishes manylinux wheels for every architecture except riscv64.

Mirrors upstream's wheels.yml, reusing its cibw_before_build.sh and test_wheels.sh.

Differs from upstream

  • PIP_EXTRA_INDEX_URL plus PIP_ONLY_BINARY=numpy,scipy,pandas — those three have no riscv64 wheels on PyPI and must come from our registry. cython and meson-python are deliberately not in the list; they have no riscv64 wheel anywhere and build from sdist.

Testing

  • same as upstream

License: ✅ cibw_before_build.sh appends the bundled-library notice to COPYING, and test_wheels.sh asserts it via check_license.py.

A gpl_sources job publishes gcc sources against the same pinned image, since auditwheel bundles the image's libgomp.

@luhenry
luhenry marked this pull request as draft August 25, 2026 13:14
scikit-learn publishes manylinux wheels for every architecture except
riscv64, so nothing installs on ubuntu-24.04-riscv today.

The workflow mirrors the `build_wheels` job of upstream's
.github/workflows/wheels.yml, narrowed to riscv64: the same
cibw_before_build.sh / test_wheels.sh entry points, the same
RUNNER_OS pass-through that check_license.py depends on, and the
same SKLEARN_SKIP_NETWORK_TESTS=1.

riscv64-only overrides:

- CIBW_MANYLINUX_RISCV64_IMAGE,
- PIP_EXTRA_INDEX_URL so numpy/scipy/pandas resolve to our riscv64
  wheels in both the build and the test phase,
- PIP_ONLY_BINARY scoped to those three so pip cannot silently
  source-build them; it is deliberately not :all:, since cython and
  meson-python have no riscv64 wheel anywhere and must compile from
  sdist in the build environment.

pytest-xdist is added to CIBW_TEST_REQUIRES: upstream's test_wheels.sh
already uses it when present, and the full sklearn suite is otherwise
too slow on the riscv64 runner.

The matrix stops at cp313 because scipy is a *build* requirement
(sklearn cimports scipy.linalg.cython_blas) and pypi.riseproject.dev
carries riscv64 scipy only up to cp313 (1.15.2); cp314/cp314t can be
added once scipy is built for them.

A gpl_sources job is included: auditwheel vendors the manylinux image's
libgomp into the wheel (scikit_learn.libs/libgomp-*.so.1.0.0, as
upstream's build_tools/wheels/LICENSE_linux.txt documents), so the gcc
sources that produced it have to be published alongside.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Reverts the temporary cp312/cp313 restriction: scipy 1.18.1 riscv64 wheels
are published for all four interpreters, including cp314t, so the build
requirement resolves.
@luhenry
luhenry marked this pull request as ready for review August 26, 2026 18:50
@luhenry

luhenry commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

Depends on scipy<1.18.0; work in progress.

@luhenry
luhenry marked this pull request as draft August 26, 2026 19:02
The cp314 and cp314t builds failed to resolve scipy<1.18.0 because the
registry stopped at 1.15.2 for cp313; scipy 1.17.1 now covers cp312, cp313,
cp314 and cp314t, so both entries can build. pandas is the remaining gap and
is not one we can close: it publishes no free-threaded wheel on any platform,
so the tests that need it skip on cp314t rather than the install failing.
@luhenry
luhenry marked this pull request as ready for review August 27, 2026 22:26
The cp314t job failed 6 of 34242, all in joblib's loky backend: the worker
dies unpickling its call item with "AttributeError: 'dict' object has no
attribute '__annotate__'" raised inside
joblib/externals/loky/process_executor.py, with no scikit-learn frame in the
traceback. cp314 passes the identical tree.

It does not reproduce off the runner. The same tests pass on
manylinux_2_39_aarch64 cp314t with scikit-learn 1.9.0 and joblib 1.5.3,
serial and under pytest-xdist, with and without the PYTHON_GIL=0 that
upstream's test_wheels.sh forces, and on macOS/arm64 cp314t. So this is
recorded as a riscv64 free-threading observation rather than a claim about
joblib in general.

The filter drops 10 tests of 47349 -- the six failures and the four sibling
parametrisations of the same process-parallel cases -- and only on cp314t;
the count was read back rather than assumed.
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.

1 participant