Skip to content

fix: explicitly set Python interpreter in maturin build to prevent using wrong version#2277

Merged
geruh merged 1 commit intoapache:mainfrom
kevinjqliu:kevinjqliu/explicitly-set-python-version-for-wheel
Mar 23, 2026
Merged

fix: explicitly set Python interpreter in maturin build to prevent using wrong version#2277
geruh merged 1 commit intoapache:mainfrom
kevinjqliu:kevinjqliu/explicitly-set-python-version-for-wheel

Conversation

@kevinjqliu
Copy link
Contributor

@kevinjqliu kevinjqliu commented Mar 23, 2026

Which issue does this PR close?

What changes are included in this PR?

Maturin auto-discovers Python interpreters inside manylinux Docker containers and may pick an older version (e.g., 3.8) instead of the intended 3.12. The actions/setup-python step only installs Python on the host runner, not inside the container. (This is called by in the maturin-action documentation)

Fix by passing -i python3.12 to maturin build in all workflows:

  • bindings_python_ci.yml
  • release_python.yml
  • release_python_nightly.yml

sdist commands are unchanged since source distributions don't target a specific interpreter.

Are these changes tested?

Yes, tested by manually triggering nightly build https://github.com/apache/iceberg-rust/actions/runs/23450629743

Log for wheels (ubuntu-latest, x86_64) shows:

🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings with abi3 support
🐍 Found CPython 3.12 at /opt/python/cp312-cp312/bin/python
📡 Using build options features from pyproject.toml
...
📦 Built wheel for abi3 Python ≥ 3.10 to dist/pyiceberg_core-0.9.0.dev20260323172059-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @kevinjqliu

working-directory: "bindings/python"
command: build
args: --release -o dist
args: --release -o dist -i python3.12 # Explicitly set interpreter; manylinux containers have multiple Pythons and maturin may pick an older one
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: non blocking we can factor out the 3.12 to a variable for future upgrades

@geruh geruh merged commit 4c08d35 into apache:main Mar 23, 2026
27 checks passed
@kevinjqliu kevinjqliu deleted the kevinjqliu/explicitly-set-python-version-for-wheel branch March 23, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: maturin picks up Python 3.8 instead of 3.12 in manylinux container

3 participants