fix: resolve wheel installation conflicts in CI matrix builds

Fix issue where multiple Python versions' wheels in the same dist directory
caused installation conflicts during CI testing. The problem occurred when
matrix builds for different Python versions accumulated wheels in shared
directories, and uv pip install would find incompatible wheels.

Changes:
- Add Python version detection using matrix.python variable
- Convert Python version to wheel tag format (e.g., 3.11 -> cp311)
- Use find with version-specific pattern matching to select correct wheels
- Add explicit error handling if no matching wheel is found

This ensures each CI job installs only wheels compatible with its specific
Python version, preventing "A path dependency is incompatible with the
current platform" errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andy Lee
2025-08-10 17:31:46 -07:00
parent 5094e6800a
commit ded0decd17

View File

@@ -249,9 +249,29 @@ jobs:
uv pip install packages/leann/dist/*.whl || uv pip install packages/leann/dist/*.tar.gz
fi
# Install backend wheels directly
uv pip install packages/leann-backend-hnsw/dist/*.whl
uv pip install packages/leann-backend-diskann/dist/*.whl
# Install backend wheels directly with Python version filtering
PYTHON_VERSION="${{ matrix.python }}"
PYTHON_TAG="cp${PYTHON_VERSION//./}" # Convert 3.11 to cp311
# Find and install the correct wheel for this Python version
HNSW_WHEEL=$(find packages/leann-backend-hnsw/dist -name "*${PYTHON_TAG}*.whl" | head -1)
DISKANN_WHEEL=$(find packages/leann-backend-diskann/dist -name "*${PYTHON_TAG}*.whl" | head -1)
if [ -n "$HNSW_WHEEL" ]; then
echo "Installing HNSW wheel: $HNSW_WHEEL"
uv pip install "$HNSW_WHEEL"
else
echo "No HNSW wheel found for Python $PYTHON_VERSION"
exit 1
fi
if [ -n "$DISKANN_WHEEL" ]; then
echo "Installing DiskANN wheel: $DISKANN_WHEEL"
uv pip install "$DISKANN_WHEEL"
else
echo "No DiskANN wheel found for Python $PYTHON_VERSION"
exit 1
fi
# Install base dependencies needed for testing (without the local packages)
uv pip install numpy torch tqdm flask flask_compress datasets evaluate colorama boto3 "protobuf==4.25.3"