Skip to content

Install Python with uv python install instead of compiling it with pyenv #1555

Open

Description

@ahmed-arb

The openedx image compiles CPython from source with pyenv:

RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.7.2 --depth 1
RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION

and the same pattern is copied in tutor-credentials and tutor-discovery. This requires a large set of -dev apt packages and a full CPython compile, which is especially slow for multi-arch release builds under QEMU emulation.

uv is already installed in the image (COPY --from=ghcr.io/astral-sh/uv). uv python install $PYTHON_VERSION downloads prebuilt python-build-standalone binaries in seconds, and uv venv --python $PYTHON_VERSION can create the virtualenv from it.

Benefits: faster image builds (particularly arm64), fewer build dependencies in the python stage, and one consistent way to provision Python across core and plugins.

Things to verify: the standalone builds bundle their own OpenSSL and SQLite, so their versions and behaviour should be checked against what edx-platform needs (e.g. MySQL client SSL, sqlite3 in tests), and the image layout under /opt/pyenv would change for anyone referencing that path in patches.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AIIssue drafted with AI assistance

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions