Skip to content

Commit 12a6da4

Browse files
committed
fix: resolve symlink issues in diffusers tarball build process
1 parent 1beffc5 commit 12a6da4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

scripts/build-diffusers-tarball.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ PYTHON_BIN=$(uv python find 3.12)
4444
PYTHON_PREFIX=$(cd "$(dirname "$PYTHON_BIN")/.." && pwd)
4545
echo "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-
5447
DIFFUSERS_VERSION="0.36.0"
5548
TORCH_VERSION="2.9.1"
5649
TRANSFORMERS_VERSION="4.57.5"
@@ -62,8 +55,15 @@ FASTAPI_VERSION="0.115.12"
6255
UVICORN_VERSION="0.34.1"
6356
PILLOW_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+
6565
echo "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
7983
echo "Installing diffusers_server module..."
8084
SITE_PACKAGES="$PYTHON_DIR/lib/python3.12/site-packages"

0 commit comments

Comments
 (0)