Skip to content

Commit 2e2926e

Browse files
committed
fix: update Python setup for Windows to include Scripts directory in python._pth and streamline pip installation
1 parent 54c669a commit 2e2926e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ jobs:
3333
run: |
3434
chmod +x setup-binaries.sh
3535
./setup-binaries.sh windows
36-
# Install Python dependencies for Windows
3736
cd python-runtime-windows
3837
./python.exe get-pip.py
39-
# Wait a moment for pip to be properly installed
4038
sleep 2
41-
./python.exe -m pip install -r ../requirements.txt
39+
./Scripts/pip.exe install -r ../requirements.txt
4240
4341
- name: Build Windows application
4442
run: npm run build:win

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ jobs:
3939
./setup-binaries.sh windows
4040
# Install Python dependencies for Windows
4141
cd python-runtime-windows
42+
# Fix the python._pth file to include Scripts directory
43+
echo "python311.zip" > python._pth
44+
echo "." >> python._pth
45+
echo "Scripts" >> python._pth
46+
echo "Lib/site-packages" >> python._pth
47+
echo "import site" >> python._pth
48+
# Install pip
4249
./python.exe get-pip.py
43-
# Wait a moment for pip to be properly installed
44-
sleep 2
45-
./python.exe -m pip install -r ../requirements.txt
50+
# Install dependencies using the Scripts/pip.exe directly
51+
./Scripts/pip.exe install -r ../requirements.txt
4652
else
4753
./setup-binaries.sh macos
4854
fi

setup-binaries.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,18 @@ setup_windows() {
8888

8989
curl -L -o python-runtime-windows/get-pip.py "https://bootstrap.pypa.io/get-pip.py"
9090

91+
# Configure python._pth to include Scripts directory and enable site-packages
9192
echo "python311.zip" > python-runtime-windows/python._pth
9293
echo "." >> python-runtime-windows/python._pth
94+
echo "Scripts" >> python-runtime-windows/python._pth
9395
echo "Lib/site-packages" >> python-runtime-windows/python._pth
9496
echo "import site" >> python-runtime-windows/python._pth
9597

9698
print_success "Windows Python runtime downloaded"
9799
print_warning "Note: To install dependencies on Windows:"
98100
print_warning " cd python-runtime-windows"
99101
print_warning " python get-pip.py"
100-
print_warning " python -m pip install -r ../requirements.txt"
102+
print_warning " Scripts/pip install -r ../requirements.txt"
101103
else
102104
print_warning "Windows Python runtime already exists, skipping..."
103105
fi

0 commit comments

Comments
 (0)