Build the CPython extension from source
Use the wheel when there is one for your platform.
Build from source to change the CPython runtime layer, or to run on a platform
without a wheel. You need only an omnipython-lvgl clone and its lvgl
submodule: no MicroPython, CircuitPython or generator. The wheel builds from
the repository root, from the generated binding committed in generated/ and
the runtime in ports/cpython/src/.
What you need
Python 3.11 or later with pip and setuptools, and the lvgl submodule.
On Linux and macOS, a C compiler (GCC or Clang) and the Python headers. On Debian and Ubuntu:
sudo apt install python3-dev build-essential
On Windows, python.org CPython and the Microsoft C++ Build Tools with the
Desktop development with C++ workload
(Visual Studio Build Tools).
MinGW cannot build this extension for python.org’s Python. Open a new terminal
after installing the Build Tools so cl.exe is on PATH.
Build and install
pip install compiles the runtime glue, the generated binding and the LVGL
sources into one extension module. Use an editable install while you work, so
the built module beside the checkout stays in step with your rebuilds.
git clone --recurse-submodules --shallow-submodules https://github.com/PyDevices/omnipython-lvgl.git
cd omnipython-lvgl
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -c "import lvgl as lv; lv.init(); lv.deinit(); print('ok')"
After a plain clone, fetch the submodule with git submodule update --init lvgl.
On Windows, from a shell:
git submodule update --init lvgl
py -m pip install -e .
py -c "import lvgl as lv; lv.init(); lv.deinit(); print('ok')"
The first build compiles every LVGL source and can take several minutes. After
C source changes, an editable install does not recompile on import: run
pip install -e . again, or rebuild in place:
.venv/bin/python setup.py build_ext --inplace
Run the unit tests with:
.venv/bin/python -m unittest discover -s ports/cpython/tests
Windows Python from WSL
Keep the repository on the WSL filesystem and install into Windows Python with
pip.exe, with no copy to C:\:
cd /path/to/omnipython-lvgl
pip.exe install -e "$(wslpath -w "$PWD")"
python.exe -c "import lvgl as lv; lv.init(); lv.deinit(); print('ok')"
Android
Prefer a prebuilt wheel tagged android_21_* for your ABI (arm64_v8a or
x86_64). The
android-template omnipythonlvgl recipe
installs a matching wheel from PyPI, and cross-compiles from your checkout
otherwise. To use your own tree:
export P4A_omnipythonlvgl_DIR=/path/to/omnipython-lvgl
Pyodide
Native wheels are not loadable in Pyodide. The release builds a
pyemscripten_2026_0 wasm32 wheel, which you install with micropip as shown
in Install. To rebuild it locally, run this from
the checkout (it downloads the Pyodide build environment and emsdk on first
use):
pipx run cibuildwheel --platform pyodide
Wheels land in wheelhouse/.