Path towards manylinux / PyPI support for loongarch64

Hi everyone,

I would like to start a discussion on what is still missing, and what would be required, to make loongarch64 a well-supported and standardized platform in the Python packaging ecosystem (PyPI / manylinux / musllinux). The long-term goal would be to reach what could be considered first-class support, meaning a platform with officially defined tags, upstream tool support, and reproducible build environments.

From the loongarch64 community side, much of the low-level infrastructure is already in place. We would like guidance on the expected and recommended path toward upstream and standardized support within PyPA.


Current status

From the perspective of tooling and operating system support, loongarch64 has reached a reasonably mature state.

Build and tooling infrastructure

CI and emulation
loongarch64 can already be emulated in CI environments via docker/setup-qemu-action.

Core packaging tools
Key tools in the Python packaging workflow, including patchelf, swig, uv, and auditwheel, support loongarch64.

Cross-build environments
Community-maintained manylinux-cross and musllinux-cross environments are available for loongarch64.


Operating system support

glibc-based environments
loongarch64 is supported by several glibc-based Linux environments that provide the ABI and runtime components typically required by the manylinux specification.

musl-based environments
Alpine Linux officially supports loongarch64 and maintains container images, although official Docker Hub images are not yet published.


CPython status

  • loongarch64 support has been upstreamed into CPython.
  • Python ≥ 3.12 recognizes the GNU triplet without requiring downstream patches.

Gaps towards standardized integration

Despite the above progress, loongarch64 is not yet a first-class target in the official Python packaging workflow.

Upstream build tooling
Building wheels for loongarch64 currently relies on manylinux/musllinux images maintained by the loongarch64 community, as well as patched or forked versions of cibuildwheel. Upstreaming this support would significantly improve accessibility for package maintainers.

Availability of manylinux build roots
While there are glibc-based environments on loongarch64 that appear to meet the technical requirements of PEP 600, there is currently a lack of publicly available, long-term-maintained container images that can serve as reproducible manylinux build roots for this architecture. This gap makes it difficult to evaluate, standardize, and upstream loongarch64 support, even when the underlying ABI and runtime requirements are satisfied.

manylinux / musllinux platform definitions
loongarch64 is not yet included in the official manylinux or musllinux platform tags defined by existing PEPs, which prevents PyPI from recognizing loongarch64 wheels as official artifacts.


Topics for discussion

We would greatly appreciate guidance from the community on the following questions:

  1. What is the recommended path to introduce loongarch64 into the official manylinux and/or musllinux specifications (PEPs)?
  2. Would it be acceptable for the loongarch64 community to provide and maintain a reference manylinux build root for evaluation purposes, based on a glibc environment that meets the requirements of PEP 600?
  3. Are there specific technical or policy prerequisites from the PyPA side for accepting a new architecture?
  4. What level of CI maturity or hardware availability is typically expected before upstream adoption?

We are keen to collaborate and continue maintaining the necessary tooling, with the goal of moving loongarch64 from “community-supported” to “officially standardized” status.

Any feedback or pointers would be very welcome.


6 Likes

It will require a PEP so that ‘packaging’ and PyPI can add support. And official CPython support helps.

Operating system support

glibc-based environments

I was interested to see Debian recently announced support for Loongarch64, it’s not only Alpine and experimental distros.

One of my recent “Yay Python” moments, was the ease with which I could run pretty much a regular CPython on an ARM single board computer, with uv too. The Debian system Python was integrated with the peripherals nicely too.

I don’t currently purchase 1U server modules, so I couldn’t find many devices on the market in the UK yet. But these chips are around and -I think- boards with them can easily be imported, e.g. from BananaPi, and the official dev board. I for one would very much enjoy using Python on them.
Regardless, it’s healthy to have competition with the x64 / ARM duopoly, and it’s great if Python adds support for more architectures in general.

1 Like

Hi everyone,

Following the recommendation to prepare a PEP, I would like to propose an initial compatibility baseline for LoongArch64 manylinux and musllinux wheels and get feedback before preparing a formal draft.

Since the original post, LoongArch64 build support has been merged into manylinux PR #1927, targeting manylinux_2_38_loongarch64 and musllinux_1_2_loongarch64. Image publication
remains pending PyPI accepting these wheels.

Proposed platform baseline

I propose retaining the existing loongarch64 architecture name and defining its baseline for manylinux and musllinux wheels as:

  • Little-endian LoongArch64 (LA64).
  • LP64D calling convention.
  • ELF object ABI v1, as defined in the LoongArch ELF ABI specification.
  • LSX (128-bit SIMD) support required; LASX (256-bit SIMD) is not required.

The LP64D and LSX requirements align with the official Rust LoongArch64 Linux targets, which is relevant for wheels containing Rust extensions.

The initial official manylinux build environment would use glibc 2.38, matching the merged manylinux implementation. The glibc version in a manylinux tag would continue to express the wheel’s glibc compatibility requirement under PEP 600. Rust’s GNU target has a lower minimum of glibc 2.36; this does not require the initial manylinux image to use that version.

For musl, I propose using musllinux_1_2_loongarch64. Upstream musl first added LoongArch64 support in version 1.2.5, which also matches the minimum musl version documented for Rust’s LoongArch64 musl target. The tag follows the major/minor version format defined by PEP 656.

Implementation approach

The architecture name and libc version alone are insufficient to establish ABI compatibility. The current packaging implementation already allows loongarch64, but does not check its LP64D or object ABI flags. I propose adding an ELF check of the running Python executable, following the existing ARM hard-float check. We would need to confirm whether these ELF checks are sufficient or whether additional runtime information is required, and apply the agreed ABI requirements to both manylinux and musllinux tag generation.

On the build side, I have prepared an auditwheel patch to validate the LP64D and ELF object ABI v1 flags in wheel binaries. This is separate from checking the installer environment, and does not establish LSX availability or complete runtime compatibility.

For ISA requirements, the RISC-V platform discussion provides a precedent for explicitly defining an ISA and calling convention baseline. I would like to establish a similarly explicit platform definition for LoongArch64.

Feedback requested

  • Is the proposed ABI and ISA baseline appropriate, and is the ARM-style ELF check a suitable starting point for installer ABI detection?
  • Rust documents compatibility with the Linux 5.19 UAPI as a requirement. Should this also be stated as a runtime requirement for this platform? I am not proposing a kernel version check in installers: version strings do not reliably describe backported interfaces, and PEP 513 explicitly considered and rejected kernel version checks.

The aim is to define a compatibility contract and agree on the necessary checks, rather than require installers to probe every runtime condition.

Would this be an appropriate scope for a Standards Track packaging PEP? I would appreciate feedback on the proposed baseline and implementation approach. If this is a suitable direction, guidance on the subsequent PEP process, including finding a sponsor, would also be welcome.

2 Likes

Looks great—time to move forward!

There is a subtle issue in feat: manylinux_2_38_loongarch64 & musllinux_1_2_loongarch64 by wojiushixiaobai · Pull Request #1927 · pypa/manylinux · GitHub : anolis (and several LoongArch distros from commercial entities or communities with commercial background) applies a glibc patch to "lower minimum kernel version to 4.19.0. I’ve no idea why they must do this, but this would cause the binary executable files in the wheel to contain “for GNU/Linux 4.19.0” in the .note.ABI-tag section (linked from glibc crt1.o).

This is bad because:

  1. The upstream glibc will never produce such a binary;
  2. It contradicts with the common knowledge among the community to distinguish the “old-world/ABI1.0” and “new-world/ABI2.0” executable binary files, when the user see such a file in the wheel they’ll likely assume someone has mistakenly uploaded an old-world wheel and make a bug report.

For example, see http://lpypi.loongnix.cn/loongson/pypi/+f/cef/7dd1813322cdc/ninja-1.13.0-py3-none-manylinux_2_38_loongarch64.whl which contains such a ninja binary.

IMO this should be resolved (perhaps by repackaging a clean glibc for anolis) before we progress with our best effort.

Thanks for pointing this out. I can confirm that this issue exists in the current build environment.

I agree that it should be addressed in the reference image. The LP64D and object ABI v1 checks proposed above do not cover the minimum kernel version recorded in .note.ABI-tag, but the misleading metadata produced by the build environment should be corrected.

I will follow up with the LoongArch Anolis maintainers to review this glibc patch.

Thanks for the updates and continued work on this @weijie & others. Your proposed approach to the ABI and ISA definition sounds right to me (modulo resolving the glibc concern that was just brought up). And having it align with Rust makes sense, and lowers maintenance cost & risk when dealing with a new platform that few folks here are familiar with or have access to. My main remaining questions about that are:

  • Is LSX indeed universal enough, and will you add detection for this to packaging to modify how loongarch64 is detected there? If the answer to both is yes, a PR to packaging that we can look at might be useful.
    • Perhaps elaborate in a bit more detail which checks belong in packaging.tags, which belong in auditwheel, and how are bundled binaries and shared libraries checked?
  • Who is involved in this proposal, and how do we assess buy-in from Loongson as the vendor and the LoongArch user community?

The maintenance cost looks like the primary concern. Who commits to long-term maintenance of the build images and CI, for manylinux in particular? Debian obtained hardware and named porters, and Rust requires named target maintainers. What is the equivalent commitment here, and can builds be tested on real hardware rather than exclusively in QEMU? (this might be a question for the manylinux maintainers as much as to you as the proposers here)

I’m actually not sure if a PEP is needed. The closest recent precedent is RISC-V, which got added to Warehouse/PyPI without a PEP (see this PR); PEP 600/656 support that. With packaging and manylinux support already merged (xref discussion and PR), and PyPI support probably a PR with a small diff away, I think it’s technically not necessary - we can revisit that with the Packaging Council. Either way, discussing the ABI/ISA choices and how those are validated seems key, and that can be done here.

I’d caution also that either way this decision or PEP will not settle:

  1. Whether it becomes a default-enabled target in cibuildwheel (that seems very far off).
  2. Whether popular open source projects will start building wheels and uploading them to PyPI (riscv64 and ppc64le experience shows that this is a long journey; native CI runners available to open source projects are a necessary but not sufficient bar for many projects).

The main benefit of this proposal seems to be support in all the standard Python packaging tools, so LoongArch users can build wheels without needing to use a fork.

1 Like

Hi Ralf, thanks for the feedback. I have now submitted both implementation PRs for review:

  • packaging #1521: checks the running Python executable for little-endian ELF64, LP64D, and object ABI v1, and checks LSX availability through getauxval(AT_HWCAP). These requirements apply to both manylinux and musllinux tag generation.
  • auditwheel #753: adds LP64D and object ABI v1 checks to ELF architecture detection, following auditwheel’s existing ARM ABI-checking approach. Unsupported ABI files are not classified as supported loongarch64 binaries.

The distinction is that packaging checks the running environment, while auditwheel checks ELF metadata on the wheel side. Auditwheel does not require LSX on the build machine or scan binaries for instruction usage. Wheel producers remain responsible for respecting the ISA baseline, including avoiding unconditional use of LASX.

I have verified ELF, HWCAP, and tag detection in real LoongArch glibc and Alpine/musl environments. I also installed prebuilt MarkupSafe, ujson, and cffi wheels and exercised their native extensions on the glibc system.

These PRs address the implementation and validation questions.

The reference-image glibc issue, confirmation of LSX hardware coverage, and vendor/community commitments to long-term image and CI maintenance remain separate outstanding items.

The PPC discussed this today and we don’t think any PEP is necessary for loongarch64 wheel tag support since it’s a CPU architecture and not an OS and manylinux has support.

For future guidelines, we think CPU architectures that want support in wheel tags should be:

  • Broadly used
  • Supported by manylinux
  • Supported by ‘packaging’

Whether PyPI supports uploads is up to the PyPI admins (which is outside the purview of the PPC).

1 Like

Thanks, Brett, and thanks to the PPC for clarifying that a PEP is not needed.

LoongArch64 support is already merged in manylinux. The additional ABI and LSX checks are under review in packaging, with the wheel-side ABI checks in auditwheel.

What would be the preferred way to request PyPI upload support—should I open an issue or PR in Warehouse, or contact the PyPI admins through another channel?

My guess is an issue with links to the support you have landed in the ecosystem.