PyBox / Python libraries
NumPy, PyTorch, OpenCV and more, built for Android.
Installing scientific Python on a phone usually means failed builds. PyBox runs its own wheel registry of prebuilt Android packages, so pip just works.
Prebuilt, so pip does not compile
Packages like NumPy, SciPy, PyTorch and OpenCV contain native code. Building them on a phone is slow and often fails. PyBox points pip at a registry of wheels built for Android ARM and x86_64, so pip install numpy downloads a binary that runs. Pure-Python packages install from PyPI as usual.
Machine learning and GPU inference
PyTorch, torchvision and torchaudio are available, as are TensorFlow and TFLite, ONNX Runtime, ONNX, NCNN, MediaPipe and llama.cpp for local language models. TensorFlow, NCNN and ONNX Runtime can use GPU acceleration for inference. Hugging Face tokenizers, safetensors and sentencepiece cover the tooling around models.
Data and science
NumPy, pandas, SciPy, Matplotlib, scikit-learn, scikit-image, statsmodels, Numba, DuckDB, PyArrow, h5py, XGBoost and LightGBM cover analysis and classical machine learning. Shapely, pyproj and Astropy cover geospatial and astronomy work. PyMuPDF reads PDFs, and lxml parses XML and HTML.
Hardware and media
OpenCV (and opencv-contrib) read the camera. PyAudio, sounddevice and soundfile handle audio. Vosk, sherpa-onnx and SpeechRecognition do speech to text, and pyttsx3 does text to speech. pygame, PyOpenGL and Kivy cover games and GUI.
Install a package
Add the name to requirements.txt and tap Sync Project, or run pip install package in the terminal. Packages download once and then work offline.
Questions
Can I install NumPy and pandas on Android?
Yes. PyBox provides prebuilt Android wheels for NumPy, pandas, SciPy, Matplotlib and scikit-learn, so pip installs them without compiling.
Does PyTorch run on Android with PyBox?
Yes. PyTorch, torchvision and torchaudio are available as Android wheels, and Hugging Face tokenizers and safetensors work alongside them.
Does OpenCV work with the camera?
Yes. cv2.VideoCapture reads the Android camera after you grant permission.
Can I run a local LLM?
There is a llama.cpp Python binding, and an ONNX Runtime LLM Chat starter project. Speed depends on the device and the model size.
Related guides
OpenCV in Python on Android: use the phone camera
How to read the Android camera with OpenCV in Python using PyBox, with a face detection example, permissions and performance tips.
ReadRun AI models on Android with Python (ONNX, TFLite, PyTorch)
How to run machine learning models on an Android device with Python: ONNX Runtime, TensorFlow Lite, PyTorch, NCNN and llama.cpp, with a working ONNX example.
ReadTensorFlow, Keras and MediaPipe on Android
TensorFlow 2.21, Keras 3, PyTorch, MediaPipe and TensorFlow Lite running as real Python on an Android phone, with the numbers from tested projects.
ReadInstall pip Packages on Android: NumPy and pandas
How to install pip packages on Android in a Python IDE: pure Python packages from PyPI, prebuilt wheels for NumPy and OpenCV, and fixes for install errors.
Read