@@ -44,13 +44,6 @@ PYTHON_BIN=$(uv python find 3.12)
4444PYTHON_PREFIX=$( cd " $( dirname " $PYTHON_BIN " ) /.." && pwd)
4545echo " Using standalone Python from: $PYTHON_PREFIX "
4646
47- # Copy the standalone Python to our work area
48- PYTHON_DIR=" $WORK_DIR /python"
49- cp -Rp " $PYTHON_PREFIX " " $PYTHON_DIR "
50-
51- # Remove the externally-managed marker so we can install packages into it
52- rm -f " $PYTHON_DIR /lib/python3.12/EXTERNALLY-MANAGED"
53-
5447DIFFUSERS_VERSION=" 0.36.0"
5548TORCH_VERSION=" 2.9.1"
5649TRANSFORMERS_VERSION=" 4.57.5"
@@ -62,8 +55,15 @@ FASTAPI_VERSION="0.115.12"
6255UVICORN_VERSION=" 0.34.1"
6356PILLOW_VERSION=" 11.2.1"
6457
58+ # Remove the externally-managed marker so uv can install packages into the
59+ # standalone Python. We install BEFORE copying to the work area because uv
60+ # resolves the interpreter's real path via symlinks; installing into a copy
61+ # whose symlinks point back to the original tree produces broken relative
62+ # paths on Linux.
63+ rm -f " $PYTHON_PREFIX /lib/python3.12/EXTERNALLY-MANAGED"
64+
6565echo " Installing diffusers and dependencies..."
66- uv pip install --python " $PYTHON_DIR /bin/python3" --system \
66+ uv pip install --python " $PYTHON_PREFIX /bin/python3" --system \
6767 " diffusers==${DIFFUSERS_VERSION} " \
6868 " torch==${TORCH_VERSION} " \
6969 " transformers==${TRANSFORMERS_VERSION} " \
@@ -75,6 +75,10 @@ uv pip install --python "$PYTHON_DIR/bin/python3" --system \
7575 " uvicorn[standard]==${UVICORN_VERSION} " \
7676 " pillow==${PILLOW_VERSION} "
7777
78+ # Copy the fully-installed Python to our work area for stripping and packaging
79+ PYTHON_DIR=" $WORK_DIR /python"
80+ cp -Rp " $PYTHON_PREFIX " " $PYTHON_DIR "
81+
7882# Install the diffusers_server module from the project
7983echo " Installing diffusers_server module..."
8084SITE_PACKAGES=" $PYTHON_DIR /lib/python3.12/site-packages"
0 commit comments