fix: prevent pyzmq compilation during tests

- Cap pyzmq version to <27 for manylinux2014 compatibility
- Pre-install pyzmq binary wheel before tests using CIBW_BEFORE_TEST
- Force pip to use only binary wheels with --only-binary :all:
This commit is contained in:
Andy Lee
2025-07-25 11:35:31 -07:00
parent b8ff00fc6a
commit 3c8d32f156
5 changed files with 76 additions and 9 deletions

View File

@@ -68,6 +68,10 @@ jobs:
CIBW_BEFORE_ALL_MACOS: |
brew install boost zeromq openblas cmake libomp
# Pre-install test dependencies to avoid compilation
CIBW_BEFORE_TEST: |
pip install --only-binary :all: "pyzmq>=23.0.0,<27"
# Test command to verify the wheel works
CIBW_TEST_COMMAND: |
python -c "import leann_backend_hnsw; print('HNSW backend imported successfully')"
@@ -125,6 +129,10 @@ jobs:
CIBW_BEFORE_ALL_MACOS: |
brew install boost zeromq openblas cmake libomp
# Pre-install test dependencies to avoid compilation
CIBW_BEFORE_TEST: |
pip install --only-binary :all: "pyzmq>=23.0.0,<27"
# Test command to verify the wheel works
CIBW_TEST_COMMAND: |
python -c "import leann_backend_diskann; print('DiskANN backend imported successfully')"
@@ -132,8 +140,8 @@ jobs:
# Skip problematic configurations
CIBW_TEST_SKIP: "*-macosx_arm64" # Skip ARM64 tests on GitHub Actions
# Test dependencies - install pre-built pyzmq to avoid compilation issues
CIBW_TEST_REQUIRES: "pytest numpy pyzmq"
# Test dependencies - avoid pyzmq due to manylinux2014 compatibility issues
CIBW_TEST_REQUIRES: "pytest numpy"
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=8

41
check_pyzmq_wheels.py Normal file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python3
"""Check which pyzmq versions have manylinux2014 wheels available."""
import json
import urllib.request
def check_pyzmq_wheels():
url = "https://pypi.org/pypi/pyzmq/json"
with urllib.request.urlopen(url) as response:
data = json.loads(response.read())
versions_with_manylinux2014 = {}
for version, releases in data["releases"].items():
manylinux_wheels = []
for release in releases:
filename = release["filename"]
if "manylinux2014" in filename or "manylinux_2_17" in filename:
if "cp310" in filename: # Python 3.10
manylinux_wheels.append(filename)
if manylinux_wheels:
versions_with_manylinux2014[version] = manylinux_wheels
# Sort versions
from packaging.version import parse
sorted_versions = sorted(
versions_with_manylinux2014.keys(), key=parse, reverse=True
)
print("PyZMQ versions with manylinux2014 wheels for Python 3.10:")
for version in sorted_versions[:10]: # Show top 10
print(f" {version}")
for wheel in versions_with_manylinux2014[version]:
print(f" - {wheel}")
if __name__ == "__main__":
check_pyzmq_wheels()

View File

@@ -11,7 +11,7 @@ description = "Custom-built HNSW (Faiss) backend for the Leann toolkit."
dependencies = [
"leann-core==0.1.8",
"numpy",
"pyzmq>=23.0.0",
"pyzmq>=23.0.0,<27", # Cap at 26.x for manylinux2014 compatibility
"msgpack>=1.0.0",
]

View File

@@ -15,7 +15,7 @@ dependencies = [
"numpy>=1.20.0",
"tqdm>=4.60.0",
"psutil>=5.8.0",
"pyzmq>=23.0.0",
"pyzmq>=23.0.0,<27", # Cap at 26.x for manylinux2014 compatibility
"msgpack>=1.0.0",
"torch>=2.0.0",
"sentence-transformers>=2.2.0",

28
uv.lock generated
View File

@@ -1800,7 +1800,7 @@ wheels = [
[[package]]
name = "leann-backend-diskann"
version = "0.1.0"
version = "0.1.8"
source = { editable = "packages/leann-backend-diskann" }
dependencies = [
{ name = "leann-core" },
@@ -1810,39 +1810,57 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "leann-core", specifier = "==0.1.0" },
{ name = "leann-core", specifier = "==0.1.8" },
{ name = "numpy" },
]
[[package]]
name = "leann-backend-hnsw"
version = "0.1.0"
version = "0.1.8"
source = { editable = "packages/leann-backend-hnsw" }
dependencies = [
{ name = "leann-core" },
{ name = "msgpack" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
{ name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
{ name = "pyzmq" },
]
[package.metadata]
requires-dist = [
{ name = "leann-core", specifier = "==0.1.0" },
{ name = "leann-core", specifier = "==0.1.8" },
{ name = "msgpack", specifier = ">=1.0.0" },
{ name = "numpy" },
{ name = "pyzmq", specifier = ">=23.0.0" },
]
[[package]]
name = "leann-core"
version = "0.1.0"
version = "0.1.8"
source = { editable = "packages/leann-core" }
dependencies = [
{ name = "llama-index-core" },
{ name = "msgpack" },
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
{ name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
{ name = "psutil" },
{ name = "python-dotenv" },
{ name = "pyzmq" },
{ name = "sentence-transformers" },
{ name = "torch" },
{ name = "tqdm" },
]
[package.metadata]
requires-dist = [
{ name = "llama-index-core", specifier = ">=0.12.0" },
{ name = "msgpack", specifier = ">=1.0.0" },
{ name = "numpy", specifier = ">=1.20.0" },
{ name = "psutil", specifier = ">=5.8.0" },
{ name = "python-dotenv", specifier = ">=1.0.0" },
{ name = "pyzmq", specifier = ">=23.0.0" },
{ name = "sentence-transformers", specifier = ">=2.2.0" },
{ name = "torch", specifier = ">=2.0.0" },
{ name = "tqdm", specifier = ">=4.60.0" },
]