Files

63 lines
2.6 KiB
Markdown

# Android / Termux install notes
Android is not a supported OBLITERATUS runtime. These notes exist so a
Termux (or other Android Python) install does not fight host wheels or
download a second setuptools behind PEP 517 isolation.
`sys.platform` on current Android CPython is `android`, not `linux`. The
locked CPU PyTorch index in `pyproject.toml` is intentionally limited to
`linux` and `win32` manylinux/Windows wheels. Do not point Android at that
index.
## Layout
1. Install the platform's own `python`, `setuptools`, and scientific
wheels first (`torch`, `numpy`, and whatever Termux already packages).
Those builds carry the Android patches that PyPI wheels do not.
`safetensors` and `tokenizers` are Rust extensions; rustup does not
host `aarch64-linux-android`, so install Termux `rust` before pip
and export the API level Python was built against (24 on current
Termux):
```bash
pkg install rust
export ANDROID_API_LEVEL=24
```
2. Isolated pip builds of meson packages (pandas, matplotlib) will try
to compile `cmake`/`ninja` from source and can hang under proot.
Install those binaries from Termux first (`pkg install ninja cmake
python-matplotlib python-scipy python-pillow python-psutil
python-pyarrow python-greenlet python-brotli python-cryptography
python-rpds-py python-msgpack libraqm harfbuzz`). PyPI `psutil`
sdists reject `sys.platform == "android"`; the Termux package is
patched. Termux matplotlib needs `libraqm`. PyPI `tokenizers` abi3
wheels fail on CPython 3.14 (`PyBaseObject_Type`); rebuild without
the `abi3` cargo feature so the extension is `cp314` instead of
`abi3`. Then install OBLITERATUS without build isolation:
```bash
python -m pip install --no-build-isolation -e ".[spaces]"
```
3. If pip still tries to compile `torch` or `numpy` from source, install
the project over the host packages instead:
```bash
python -m pip install --no-build-isolation --no-deps -e .
# Preserve the reviewed URL/hash while avoiding a second core dependency build.
python - <<'PY'
import subprocess, sys, tomllib
with open("pyproject.toml", "rb") as stream:
spaces = tomllib.load(stream)["project"]["optional-dependencies"]["spaces"]
subprocess.run([sys.executable, "-m", "pip", "install", "--no-build-isolation", *spaces], check=True)
PY
```
Do not use `uv sync --locked` on Android. The lock resolves Linux/Windows
CPU PyTorch and does not contain `android_*` wheels for torch, numpy,
pyarrow, tokenizers, or bitsandbytes.
The `quantization` and `qwen-hybrid` extras are CUDA-oriented and are not
an Android install path.