Skip to content

Makefile falls back to system Python #91

@sagiahrac

Description

@sagiahrac

Right now, detect-python in the Makefile has two flows:
• If python3 is found, it records that system interpreter’s path + version in cgo_functions.go.
• If not, it downloads Python 3.11.7 into build/python-3.11.7 and updates the placeholders.

On most developer machines (Linux/macOS), python3 is almost always present, so the system branch is taken nearly every time. The fallback branch (downloaded Python) only triggers in rare environments, such as minimal Docker images or systems without Python preinstalled.

This creates two problems when the system branch is used:
1. System pollution – heavy deps (torch, transformers) install globally.
2. Version drift – build relies on whatever Python the OS provides, which may not match project requirements.

Proposal

Even when system Python is found, we should still create a dedicated environment (e.g. via uv or venv) and pin the Python version. This avoids polluting the global environment and ensures reproducibility, while still allowing the fallback download in truly Python-less environments.
A good option is to use uv, since it both isolates dependencies and manages the Python version automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions