The Linux Foundation Projects
Skip to main content
Blog

Easy Installation of Binary Python Packages on riscv64 Devices

By May 14, 2025No Comments

by Mark Ryan, RIVOS

Why can it be difficult to install Python packages on riscv64 devices?

The Python Package Index (PyPI) offers both pure Python and binary packages. Binary packages, which are pre-compiled, require separate wheel files (the format of the package) for each CPU architecture, such as x86 and aarch64. Currently, riscv64 architecture lacks binary wheels on PyPI, significantly hindering and complicating the installation of binary Python packages on riscv64 systems. This absence presents a major obstacle.

Approximately 15% of the top 10,000 PyPI packages are binary, including widely used libraries like numpy, scipy, pandas, pillow, and scikit-learn. This issue is compounded by the fact that many pure Python packages rely on these binary dependencies. For instance, Jupyter notebook, which depends on numpy, pillow, and matplotlib, faces installation challenges on riscv64 devices due to the unavailability of these binary wheels.

RISE’s wheel_builder project can help!

The wheel_builder project provides pre-built riscv64 wheels for popular Python packages, simplifying installation on riscv64 devices using pip or uv. To install a package like numpy, use the following command, specifying the index URL:

pip install numpy –index-url https://gitlab.com/api/v4/projects/56254198/packages/pypi/simple

Note that riscv64 support requires pip version 24.1 or later. If you have an older version, upgrade pip first:

​​python -m pip install –upgrade pip

Click here to see a list of the Python packages currently available on wheel_builder.

What challenges does wheel_builder address?

Challenge: Without pre-built wheels, binary packages must be built locally from source.  Building from source is slow.  It takes 15 minutes to build numpy on a VisionFive 2.  It can take hours to build and install packages that have multiple binary dependencies, e.g., pytorch or Jupyter notebook, as all the dependencies must also be built.

Solution: Installing numpy from the wheel_builder package registry takes about 25 seconds on a VisionFive 2. 


Challenge: The build will only succeed if you have all the required build tools installed locally.

Solution: No build tools required.


Challenge: Building from source may not work.  Most Python packages do not currently validate their releases on riscv64 devices, so there is no guarantee that the package will build or work correctly on riscv64. Some of these projects may never have been built for riscv64 before.

Solution: The wheel_builder project only distributes working Python wheels.  The wheel_builder project is often required to patch wheels in order to get them to work properly on riscv64.  Any patches applied to a wheel are clearly visible from the documentation and are submitted upstream when appropriate.  We know the wheels work because they are tested.  Wheel_builder attempts to run the same set of tests that are run by the upstream projects when testing their wheels for upload to PyPI.  We are required to disable tests in some cases.  This can be due to a known bug or a limitation with our build environment, qemu-user running on an x86 host.  Any disabled tests are clearly listed in the wheel_builder documentation.


Challenge: Building from source for complex Python packages with non-Python dependencies like numpy and scipy is often problematic. These packages rely on specific, bundled versions of external libraries (e.g., OpenBLAS) within their wheels to guarantee availability and compatibility. Replicating PyPI binary packages by building from source requires building the exact versions of these dependencies locally, a time-consuming and error-prone process due to complicated build instructions and potential patching needs. Using system-provided dependency versions offers no assurance of successful building or correct functionality.

Solution: Packages on wheel_builder are built the same way as their counterparts on PyPI.  They are built against and bundle the correct versions of any non-Python dependencies. For example, the numpy v2.2.2 wheels distributed by wheel_builder bundle the exact same version of OpenBLAS, scipy-openblas64 version 0.3.28.0.2, that is shipped with the numpy v2.2.2 wheels on PyPI.  The wheels downloaded from wheel_builder have the same bill of materials as their counterparts on PyPI and are expected to behave in the same way.

What’s next?

The wheel_builder project is continually expanding the number of Python packages it supports.  It also continues to maintain its existing packages, updating them when new upstream versions are released.  The barriers to building and uploading riscv64 wheels to PyPI will eventually be removed and upstream projects will be able to begin supporting riscv64 themselves.  This process will be facilitated by the work being done on the wheel_builder project to ensure that the most popular Python wheels work on riscv64.  As this happens, the need for the wheel_builder project will slowly diminish, but at the time of writing, in the spring of 2025, if you need to deploy a Python workload on a riscv64 device, you’re almost certainly going to need the wheel_builder project.

More about wheel_builder

The wheels distributed by the wheel_builder project are currently manylinux_2_35 wheels meaning that they will run on any Linux distribution that ships with glibc 2.35 or greater.  Wheels are available for CPython 3.10, 3.11, 3.12 and 3.13.

At the time of writing, the wheel_builder project distributes wheels for 49 separate projects, including some of the most popular Python packages such as numpy, scipy, pandas, pillow, matplotlib and PyYAML.  More packages are planned.  The wheel_builder project also provides multiple versions of the packages it supports.  Wheel_builder publishes new wheels when new versions of the upstream projects it builds are released.  As updates to the more complex projects can be a time consuming task, the availability of new versions on wheel_builder can lag the upstream releases by weeks or in some cases, months.  A best effort is made to keep wheel_builder’s packages up to date.

Wheel_builder is an open source project.  It contains a collection of CI build scripts and patches for building the wheels. The CI scripts are licensed under the Apache 2.0 license. The patches are licensed under the same terms as the projects they modify.  The wheel_builder project was begun by Rivos Inc. and is supported by RISE (RISC-V Software Ecosystem) .  RISE funds the machines needed to build the wheels.  It also funds engineering resources, via a Request for Proposal (RFP).  The wheel_builder project is developed and maintained by Rivos and Baylibre (who successfully bid for the RISE RFP).

Relevant Links