Skip to content

Use system Python to install packages for embeddable Python#331

Merged
t0mdavid-m merged 1 commit intomainfrom
claude/fix-windows-python-build-tnT0n
Jan 29, 2026
Merged

Use system Python to install packages for embeddable Python#331
t0mdavid-m merged 1 commit intomainfrom
claude/fix-windows-python-build-tnT0n

Conversation

@t0mdavid-m
Copy link
Member

@t0mdavid-m t0mdavid-m commented Jan 29, 2026

Summary

This PR fixes package installation for Windows embeddable Python by using the system Python installation to compile and install packages into the embeddable Python's site-packages directory, rather than attempting to use the embeddable Python directly.

Problem

The embeddable Python distribution lacks development headers (Python.h) needed to compile native extensions. Attempting to install packages directly with the embeddable Python fails when packages require compilation, resulting in errors like:

fatal error C1083: Cannot open include file: 'Python.h': No such file or directory

Solution

  • Removed the manual pip installation step that downloaded and ran get-pip.py on the embeddable Python
  • Added a prerequisite step to set up the system Python (same version as embeddable)
  • Changed package installation to use system Python with --target flag to install packages into the embeddable Python's Lib/site-packages directory
  • Updated documentation to explain the requirement and the new installation approach

Changes Made

  1. build-windows-executable-app.yaml: Removed pip installation step, updated package installation command to use system Python with --target
  2. test-win-exe-w-embed-py.yaml: Added system Python setup step, removed pip installation step, updated package installation command
  3. docs/win_exe_with_embed_py.md: Added prerequisites section, removed pip installation instructions, updated package installation instructions with explanation and warnings

Key Implementation Details

  • System Python is set up using actions/setup-python@v5 with the same version as the embeddable Python
  • Packages are installed using: python -m pip install -r requirements.txt --target python-3.11.9/Lib/site-packages --upgrade --no-warn-script-location
  • The --target flag directs pip to install into the embeddable Python's site-packages while using the system Python's compiler and headers
  • Documentation includes clear warnings about not using the embeddable Python directly for package installation

https://claude.ai/code/session_0152zcfBS5dWLtM12ubuYrKC

Summary by CodeRabbit

  • Documentation

    • Updated Windows executable build guide with new prerequisites and installation requirements for embeddable Python.
  • Chores

    • Improved build and test workflows for Windows executables by refining dependency installation process to use system Python for package compilation.

✏️ Tip: You can customize this high-level summary in your review settings.

The embeddable Python distribution lacks development headers (Python.h)
required to compile native extensions. When using the embeddable Python's
pip directly, packages with native code fail to build with:

  fatal error C1083: Cannot open include file: 'Python.h'

This fix uses the system Python (which has headers) to compile packages,
while directing the output to the embeddable Python's site-packages
directory using pip's --target flag.

Changes:
- build-windows-executable-app.yaml: Use system Python with --target,
  remove unnecessary pip installation in embeddable Python
- test-win-exe-w-embed-py.yaml: Add setup-python action, use system
  Python with --target, remove pip installation step
- docs/win_exe_with_embed_py.md: Add prerequisites section explaining
  the need for system Python, update install command to use --target

https://claude.ai/code/session_0152zcfBS5dWLtM12ubuYrKC
@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Modified GitHub workflows and documentation for Windows executable creation with embedded Python to use system Python for package installation into embedded Python's site-packages, replacing direct embeddable Python pip usage and removing standalone pip installation steps.

Changes

Cohort / File(s) Summary
GitHub Workflows
.github/workflows/build-windows-executable-app.yaml, .github/workflows/test-win-exe-w-embed-py.yaml
Refactored dependency installation to use system Python with --target flag directing packages to embedded Python's site-packages. Removed separate pip installation steps and added comments explaining embedded Python lacks Python.h headers for native extensions. Added setup-python action to ensure system Python availability.
Documentation
docs/win_exe_with_embed_py.md
Added Prerequisites section requiring system Python matching embedded Python version. Included explicit Python 3.11.9 installation instructions. Updated package installation instructions to use system Python with --target path. Added Important note prohibiting direct pip usage on embedded Python with Python.h missing error example. Removed standalone pip installation block.

Poem

🐰 A system Python hops in with care,
Installing packages with --target flair,
While embedded Python sits peaceful and light,
No headers needed, the workflow's just right!
Together they work, a beautiful sight! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: using system Python to install packages for embeddable Python instead of using embeddable Python directly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@t0mdavid-m t0mdavid-m merged commit b8bd2c2 into main Jan 29, 2026
6 of 8 checks passed
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.

2 participants