Hi all,
I’ve spent some time this year building riscv64 binary wheels for a select set of Python packages, e.g., numpy and scipy, and trying to understand what is preventing upstream projects from creating riscv64 binary wheels themselves and uploading those wheels to PyPI. I thought it might be useful to share my understanding of the current situation in the hope that this may be helpful to others interested in riscv64, in the hope that the Python packaging community can help me identify things I’ve got wrong or things that I’ve missed, and also, to start a discussion on what would need to be done to get full riscv64 support added to the pypa and other related projects. My understanding is based on the experience I’ve gained from building riscv64 wheels and also from reading the related issues and discussions in the various pypa github projects.
Current state of Packaging support for riscv64
This is the situation today as I understand it. I’m primarily interested in manylinux so my summary has a manylinux focus.
Python projects, like numpy, cannot currently create manylinux wheels for riscv64 as the infrastructure projects used to build manylinux wheels do not support riscv64. cibuildwheel, auditwheel and manylinux itself are all lacking riscv64 support.
The existing manylinux images for other architectures are based on AlmaLinux and, at the time of writing, AlmaLinux does not support riscv64. Ubuntu does support riscv64 (22.04 and 24.04 are available) but I understand that debian based distros are not a good basis for manylinux images due to their lack of GCC Toolset and because projects that use manylinux may assume a redhat based distro in their build/test scripts. It’s not clear to me whether the base image for the manylinux_2_34 image has been chosen yet but the candidates in the tracking issue (1585) all appear to be RHEL derivatives.
Auditwheel doesn’t support riscv64 but policy files with riscv64 support are available in the pep 600 compliance repository.
Cibuildwheel is also lacking support for riscv64.
A comment in the riscv64 auditwheel issue (408) suggests that PyPI might also need to be updated before it will accept riscv64 wheels.
There is a little bit of good news however. pip 24.1 is capable of installing riscv64 manylinux wheels (see below for why this is useful today).
Looking beyond the pypa projects, other tools like uv and maturin may need to be updated before riscv64 wheels can be created for projects that depend on these tools.
Needless to say, updating the pypa projects to support riscv64 is only a small piece of the overall work required. Python projects that build binary wheels would need to be individually updated to create wheels for riscv64, but these tasks I think, fall beyond the scope of this discussion.
Another potential issue projects may face is the lack of riscv64 runners. It is possible to build smaller projects with the default github runners using qemu-user but such an approach is unlikely to work for larger projects, including manylinux itself, that take a long time to build. Self-hosted runners may be necessary for these larger projects.
The main blocker to adding upstream support for manylinux riscv64 to the pypa projects is the lack of a RHEL derived distro for riscv64. Once such a distro becomes available, we’ll be able to create upstream manylinux images for riscv64 (assuming appropriate runners are available) and add riscv64 support to auditwheel and cibuildwheel.
I believe that adding linux-riscv64 platform support to the pypa projects would not require a new PEP.
What did I miss?
Does that seem like a reasonable summary of the status quo? What did I get wrong? Is there anything I’m obviously missing here?
Also, is there any useful work that can be done upstream for riscv64 in the pypa projects before an appropriate riscv64 base image for manylinux becomes available? I’d be happy to contribute/participate in any such efforts.
riscv64 wheels built by RISE
One final comment. Until riscv64 is supported by the pypa packaging projects and PyPI, Python projects, such as numpy or scipy cannot build and upload riscv64 binary packages to PyPI. Users of riscv64 devices are obliged to build these packages locally, and doing so is time-consuming and hard to get right, making it difficult to use Python for things like AI and numerical analysis on riscv64. For this reason, the RISE project is currently building and publishing manylinux_2_35_riscv64 packages for a select set of projects on RISE’s gitlab. These wheels are built using patched versions of manylinux (patched to use Ubuntu 22.04), cibuildwheel and auditwheel. They can be installed using upstream pip 24.1.