From 5259becd3cf8501a294913a7f28a0b8a454cb875 Mon Sep 17 00:00:00 2001 From: Simo Lin Date: Wed, 29 Oct 2025 12:45:18 -0700 Subject: [PATCH] [bug] fix router installation to include additional dependency (#12348) --- .github/workflows/nightly-release-router.yml | 2 +- .github/workflows/pr-test-pd-router.yml | 2 +- .github/workflows/pr-test-rust.yml | 6 ++--- .github/workflows/release-pypi-router.yml | 2 +- python/sglang/srt/grpc/compile_proto.py | 3 +++ scripts/ci/ci_install_dependency.sh | 28 +++++++++++++++++++- sgl-router/Cargo.toml | 3 ++- sgl-router/README.md | 10 ++++++- 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly-release-router.yml b/.github/workflows/nightly-release-router.yml index af98af785..97b31976e 100644 --- a/.github/workflows/nightly-release-router.yml +++ b/.github/workflows/nightly-release-router.yml @@ -94,7 +94,7 @@ jobs: with: target: ${{ matrix.target }} manylinux: ${{ matrix.manylinux || 'auto' }} - args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14' }} + args: --release --out dist --features vendored-openssl --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14' }} rust-toolchain: stable docker-options: -e CI -e CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc -e CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ before-script-linux: | diff --git a/.github/workflows/pr-test-pd-router.yml b/.github/workflows/pr-test-pd-router.yml index 228f1f5eb..2c8092af7 100644 --- a/.github/workflows/pr-test-pd-router.yml +++ b/.github/workflows/pr-test-pd-router.yml @@ -149,7 +149,7 @@ jobs: echo "Building sgl-router..." cd sgl-router pip install maturin - maturin build --release --out dist + maturin build --release --out dist --features vendored-openssl pip install --force-reinstall dist/*.whl - name: Start disaggregation servers diff --git a/.github/workflows/pr-test-rust.yml b/.github/workflows/pr-test-rust.yml index a5dbcb39a..02cf5682c 100644 --- a/.github/workflows/pr-test-rust.yml +++ b/.github/workflows/pr-test-rust.yml @@ -57,7 +57,7 @@ jobs: - name: Test maturin build uses: PyO3/maturin-action@v1 with: - args: --release --out dist + args: --release --out dist --features vendored-openssl rust-toolchain: stable sccache: true @@ -166,7 +166,7 @@ jobs: export RUSTC_WRAPPER=sccache cd sgl-router pip install maturin - maturin build --release --out dist + maturin build --release --out dist --features vendored-openssl pip install --force-reinstall dist/*.whl @@ -263,7 +263,7 @@ jobs: export RUSTC_WRAPPER=sccache cd sgl-router pip install maturin - maturin build --release --out dist + maturin build --release --out dist --features vendored-openssl pip install --force-reinstall dist/*.whl - name: Run Python E2E response API tests diff --git a/.github/workflows/release-pypi-router.yml b/.github/workflows/release-pypi-router.yml index 7bd615cb9..636076a5f 100644 --- a/.github/workflows/release-pypi-router.yml +++ b/.github/workflows/release-pypi-router.yml @@ -79,7 +79,7 @@ jobs: with: target: ${{ matrix.target }} manylinux: ${{ matrix.manylinux || 'auto' }} - args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14' }} + args: --release --out dist --features vendored-openssl --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14' }} rust-toolchain: stable docker-options: -e CI -e CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc -e CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ before-script-linux: | diff --git a/python/sglang/srt/grpc/compile_proto.py b/python/sglang/srt/grpc/compile_proto.py index c2c4c0aa6..4dc5622b0 100755 --- a/python/sglang/srt/grpc/compile_proto.py +++ b/python/sglang/srt/grpc/compile_proto.py @@ -18,6 +18,9 @@ Options: ### Install Dependencies pip install "grpcio==1.75.1" "grpcio-tools==1.75.1" +Please make sure to use the same version of grpcio and grpcio-tools specified in pyproject.toml +otherwise update the versions specified in pyproject.toml + ### Run Script cd python/sglang/srt/grpc python compile_proto.py diff --git a/scripts/ci/ci_install_dependency.sh b/scripts/ci/ci_install_dependency.sh index 3130aceb0..a72f40530 100755 --- a/scripts/ci/ci_install_dependency.sh +++ b/scripts/ci/ci_install_dependency.sh @@ -24,6 +24,29 @@ rm -rf /root/.cache/flashinfer # Install apt packages apt install -y git libnuma-dev +# Install protoc for router build (gRPC protobuf compilation) +if ! command -v protoc &> /dev/null; then + echo "Installing protoc..." + if command -v apt-get &> /dev/null; then + # Ubuntu/Debian + apt-get update + apt-get install -y wget unzip gcc g++ perl make + elif command -v yum &> /dev/null; then + # RHEL/CentOS + yum update -y + yum install -y wget unzip gcc gcc-c++ perl-core make + fi + + cd /tmp + wget https://github.com/protocolbuffers/protobuf/releases/download/v32.0/protoc-32.0-linux-x86_64.zip + unzip protoc-32.0-linux-x86_64.zip -d /usr/local + rm protoc-32.0-linux-x86_64.zip + protoc --version + cd - +else + echo "protoc already installed: $(protoc --version)" +fi + # Install uv if [ "$IS_BLACKWELL" = "1" ]; then # The blackwell CI runner has some issues with pip and uv, @@ -58,8 +81,11 @@ else $PIP_CMD install -e "python[dev]" --extra-index-url https://download.pytorch.org/whl/${CU_VERSION} $PIP_INSTALL_SUFFIX --upgrade fi +# Install OpenSSL development libraries for router build +apt install -y libssl-dev pkg-config + # Install router for pd-disagg test -SGLANG_ROUTER_BUILD_NO_RUST=1 $PIP_CMD install -e "sgl-router" $PIP_INSTALL_SUFFIX +$PIP_CMD install -e "sgl-router" $PIP_INSTALL_SUFFIX # Install sgl-kernel SGL_KERNEL_VERSION_FROM_KERNEL=$(grep -Po '(?<=^version = ")[^"]*' sgl-kernel/pyproject.toml) diff --git a/sgl-router/Cargo.toml b/sgl-router/Cargo.toml index 165ddfe91..28058109c 100644 --- a/sgl-router/Cargo.toml +++ b/sgl-router/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" default = ["grpc-client"] grpc-client = [] grpc-server = [] +vendored-openssl = ["openssl/vendored"] [lints.rust] unused_qualifications = "warn" @@ -67,7 +68,7 @@ tiktoken-rs = { version = "0.7.0" } minijinja = { version = "2.0", features = ["unstable_machinery", "json", "builtins"] } minijinja-contrib = { version = "2.0", features = ["pycompat"] } rustls = { version = "0.23", default-features = false, features = ["ring", "std"] } -openssl = { version = "0.10.73", features = ["vendored"] } +openssl = "0.10.73" hf-hub = { version = "0.4.3", features = ["tokio"] } rmcp = { version = "0.8.3", features = ["client", "server", "transport-child-process", diff --git a/sgl-router/README.md b/sgl-router/README.md index ed7b27f25..78ae3ac26 100644 --- a/sgl-router/README.md +++ b/sgl-router/README.md @@ -70,13 +70,21 @@ cargo build --release pip install maturin # Fast development mode (debug build, no wheel, instant) +# Uses system OpenSSL (requires libssl-dev/openssl-devel) maturin develop # Production build (optimized, creates wheel) +# Uses vendored OpenSSL (cross-platform compatibility) +maturin build --release --features vendored-openssl +pip install --force-reinstall dist/*.whl + +# Development build with system OpenSSL (faster) +# Requires: apt install libssl-dev pkg-config (Ubuntu/Debian) +# or: yum install openssl-devel (RHEL/CentOS) maturin build --release pip install --force-reinstall dist/*.whl ``` -> **Note:** Use `maturin develop` for fast iteration during development (builds in debug mode and installs directly). Use `maturin build --release` for production wheels with full optimizations (opt-level="z", lto="fat"). The package uses abi3 support for Python 3.8+ compatibility. +> **Note:** Use `maturin develop` for fast iteration during development (builds in debug mode and installs directly). Use `maturin build --release --features vendored-openssl` for production wheels with full optimizations (opt-level="z", lto="fat") and cross-platform compatibility. The package uses abi3 support for Python 3.8+ compatibility. ## Quick Start