Skip to content

ci: add riscv64 wheel builds#506

Open
gounthar wants to merge 3 commits into
openai:mainfrom
gounthar:add-riscv64-wheels
Open

ci: add riscv64 wheel builds#506
gounthar wants to merge 3 commits into
openai:mainfrom
gounthar:add-riscv64-wheels

Conversation

@gounthar
Copy link
Copy Markdown

@gounthar gounthar commented Mar 12, 2026

Summary

Add linux_riscv64 wheels to the build workflow, mirroring the existing
aarch64 build job.

Changes

  • New build_wheels_riscv64 job using cibuildwheel + QEMU emulation
  • Targets CPython 3.10–3.14 (including free-threaded) on manylinux_riscv64
  • Skips musllinux (no riscv64 image available)
  • Includes Rust/Cargo environment for cross-compilation inside QEMU
  • 120-minute timeout to account for QEMU + Rust compilation overhead
  • Added to join_artifacts dependency list

Evidence

A tested riscv64 wheel is available in our community index:
https://gounthar.github.io/riscv64-python-wheels/simple/tiktoken/

Built natively on BananaPi F3 (SpacemiT K1, rv64imafdcv, 8 cores @ 1.6 GHz, 16 GB RAM).

Context

  • manylinux_2_28_riscv64 is available in pypa/manylinux
  • cibuildwheel 3.x supports riscv64 via QEMU
  • Rust cross-compiles to riscv64gc-unknown-linux-gnu inside the manylinux container
  • Several packages already ship riscv64 wheels on PyPI (aiohttp, yarl, multidict, regex)
  • RISC-V hardware is shipping (SiFive, SpacemiT K1/K3, Sophgo SG2044)

Closes #502


Note: this work is part of the RISE Project effort to improve Python ecosystem support on riscv64 platforms. Native riscv64 CI runners are available for free via RISE RISC-V runners.

Add a build_wheels_riscv64 job using cibuildwheel with QEMU emulation.
Targets CPython 3.10-3.14 (including free-threaded) on manylinux_riscv64.
Skips musllinux (no riscv64 image available). Higher timeout (120 min)
to account for QEMU + Rust compilation overhead.

Closes openai#502
@gounthar
Copy link
Copy Markdown
Author

Native build verified on riscv64 hardware (BananaPi F3, SpacemiT K1, rv64gc, GCC 14.2.0): SUCCESS.

@gounthar
Copy link
Copy Markdown
Author

Successful riscv64 build on native RISE runner (~5 min): https://github.com/gounthar/tiktoken/actions/runs/23745982111

Comment thread .github/workflows/build_wheels.yml Outdated
python-version: [310, 311, 312, 313, 313t, 314, 314t]

steps:
- uses: actions/checkout@v6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use a pinned version as other jobs do?

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justeph Done. Pinned all four actions in the riscv64 job (checkout, setup-qemu-action, cibuildwheel, upload-artifact) to commit hashes, matching the pattern used in the other jobs.

Comment thread .github/workflows/build_wheels.yml Outdated
platforms: linux/riscv64

- name: Build wheels
uses: pypa/cibuildwheel@v3.1.4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here pinned version

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justeph Fixed in the same commit.

Comment thread .github/workflows/build_wheels.yml Outdated
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI=true
CIBW_ENABLE: cpython-freethreading

- uses: actions/upload-artifact@v6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here pinned version

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justeph Fixed in the same commit.

@justeph
Copy link
Copy Markdown

justeph commented Apr 30, 2026

Any chance to get this merged? For reference, I forked @gounthar branch into my namespace to run the workflow, and it succeeded in 23 mins. See https://github.com/justeph/tiktoken/actions/runs/25152519227. Is that acceptable?

Mirror the pinning pattern used in build_wheels and build_wheels_aarch64.

Signed-off-by: Bruno Verachten <gounthar@gmail.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.

Add riscv64 (linux_riscv64) wheel to PyPI releases

2 participants