Skip to content

BLD: Add Android support#30412

Draft
mhsmith wants to merge 9 commits into
numpy:mainfrom
mhsmith:android
Draft

BLD: Add Android support#30412
mhsmith wants to merge 9 commits into
numpy:mainfrom
mhsmith:android

Conversation

@mhsmith

@mhsmith mhsmith commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

@mhsmith

mhsmith commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

The 2.3.2-1 wheels here were built using the following procedure:

  • Use a Linux or Mac machine.
  • Check out this PR.
  • cd to the top-level directory of this repository.
  • git submodule update --init
  • Create and activate a Python 3.13 virtual environment.
  • Run pip install git+https://github.com/mhsmith/cibuildwheel@android-numpy
  • Run cibuildwheel --only cp313-android_ARCH, where ARCH is either arm64_v8a or x86_64.
  • cibuildwheel will attempt to run the test suite on an Android emulator. If you don't want that, set the environment variable CIBW_TEST_SKIP="*".

These wheels pass the entire test suite except for:

  • A number of tests involving floating point exceptions which are expected to occur but don't. The discussion in #29724 indicates this may be caused by slight differences between compilers.
  • 3 tests called test_legacy_pickle, due to bugs in how the testbed handles .gz files. I have a fix for this in python/cpython#142912, which I'll eventually include in the cibuildwheel PR.
  • On Chaquopy 17, this workaround is required.

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mhsmith! It's fine to keep this PR open for reference if that's useful to you, however note that we're unlikely to do another 2.3.x release and even if we did, we'd want the changes to land in main first.

The test suite changes all seem fine, I'd be happy to merge those in a separate PR to main (possibly together with the related changes for iOS, to avoid the duplication).

The hardcoding of longdouble for Android (and iOS) also seems okay and fine to merge separately.

The wheel build changes I'd prefer to not merge, at least until everything upstream is ready and then we can reassess.

@mhsmith

mhsmith commented Dec 30, 2025

Copy link
Copy Markdown
Contributor Author

Thanks: I intend to create a set of similar PRs for numpy, pandas, scipy, and scikit-learn, so I can produce wheels of known versions for some Chaquopy users I'm working with. Once these PRs are fully working, I'll retarget them to the main branch of each project to enable them to release Android wheels on PyPI.

Comment thread pyproject.toml Outdated
Comment thread .github/workflows/macos.yml
@mhsmith mhsmith changed the base branch from maintenance/2.3.x to main June 25, 2026 00:04
@rgommers

Copy link
Copy Markdown
Member

I'd still be happy to merge all the test changes separately.

In case you haven't seen it yet, we now have NEP 57 — NumPy platform support, defining CPython-like support tiers. It may be reasonable for this PR to aim to promote Android to Tier 3 by adding a CI job, similar to the current Emscripten one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

36 - Build Build related PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Android Support

2 participants