Skip to content

Commit 8ced585

Browse files
committed
Fix Python 3.12 build issues
- Add wheel package dependencies for Python 3.12 virtualenv creation - Install PyTorch before other packages to satisfy auto_gptq dependencies - Add special handling for Python 3.12 in build script
1 parent 507aaeb commit 8ced585

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/workflows/ubuntu-packages-and-docker-image.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,24 @@ jobs:
2626
UBUNTU_VERSION: ${{ matrix.ubuntu_version }}
2727
run: |
2828
sudo apt update
29-
sudo apt install -y python3-dev python3-pip python3-virtualenv
29+
sudo apt install -y python3-dev python3-pip python3-virtualenv software-properties-common python3-wheel-whl python3-pip-whl python3-setuptools-whl
30+
31+
# Add deadsnakes PPA for all Python versions
32+
sudo add-apt-repository -y ppa:deadsnakes/ppa
33+
sudo apt update
3034
3135
# Install specific Python versions based on Ubuntu target
3236
if [[ "$UBUNTU_VERSION" == "20.04" ]]; then
3337
sudo apt install -y python3.8 python3.8-dev python3.8-venv
3438
elif [[ "$UBUNTU_VERSION" == "22.04" ]]; then
3539
sudo apt install -y python3.10 python3.10-dev python3.10-venv
3640
elif [[ "$UBUNTU_VERSION" == "24.04" ]]; then
37-
# Add deadsnakes PPA for Python 3.12 on Ubuntu 22.04
38-
sudo add-apt-repository -y ppa:deadsnakes/ppa
39-
sudo apt update
4041
sudo apt install -y python3.12 python3.12-dev python3.12-venv
4142
fi
4243
44+
# Install PyTorch before running the build script to satisfy auto_gptq's requirements
45+
pip install torch --user
46+
4347
bash packages/postgresml-python/release.sh ${{ inputs.packageVersion }} ${{ matrix.ubuntu_version }}
4448
4549
#

packages/postgresml-python/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ fi
4949
virtualenv --python="python${PYTHON_VERSION}" "$deb_dir/var/lib/postgresml-python/pgml-venv"
5050
source "$deb_dir/var/lib/postgresml-python/pgml-venv/bin/activate"
5151

52+
# For Python 3.12, ensure PyTorch is installed first
53+
if [[ "${PYTHON_VERSION}" == "3.12" ]]; then
54+
python -m pip install torch
55+
fi
56+
5257
python -m pip install -r "${deb_dir}/etc/postgresml-python/requirements.txt"
5358

5459
deactivate

0 commit comments

Comments
 (0)