From 199df03524961c5d1d545abf1a017136dce90c1b Mon Sep 17 00:00:00 2001 From: DreamerLeader <88812830+DreamerLeader@users.noreply.github.com> Date: Sat, 14 Mar 2026 21:23:05 +0800 Subject: [PATCH] =?UTF-8?q?[BugFix]Fix=20CI=20errors=20=E2=80=9Cascend=5Ft?= =?UTF-8?q?ransport.so:=20cannot=20open=20shared=20object=20file:=20No=20s?= =?UTF-8?q?uch=20file=20or=20directory=E2=80=9D=20(#7242)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What this PR does / why we need it? Conditional Import for Mooncake: The import of mooncake.engine.TransferEngine was moved into a try-except block within the GlobalTE class's constructor. This ensures that mooncake is only imported when needed and provides a clear error message with installation instructions if it's missing. ### Does this PR introduce _any_ user-facing change? The error message "ascend_transport.so: cannot open shared object file: No such file or directory" in the CI is fixed to ensure the normal running of the CI. - vLLM version: v0.17.0 - vLLM main: https://github.com/vllm-project/vllm/commit/4034c3d32e30d01639459edd3ab486f56993876d --------- Signed-off-by: 房建伟 Co-authored-by: 房建伟 --- .../kv_transfer/utils/mooncake_transfer_engine.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vllm_ascend/distributed/kv_transfer/utils/mooncake_transfer_engine.py b/vllm_ascend/distributed/kv_transfer/utils/mooncake_transfer_engine.py index 3527f9cd..7cf309b0 100644 --- a/vllm_ascend/distributed/kv_transfer/utils/mooncake_transfer_engine.py +++ b/vllm_ascend/distributed/kv_transfer/utils/mooncake_transfer_engine.py @@ -1,7 +1,5 @@ import threading -from mooncake.engine import TransferEngine # type: ignore - class GlobalTE: def __init__(self): @@ -15,8 +13,14 @@ class GlobalTE: with self.transfer_engine_lock: # Double-Checked Locking if self.transfer_engine is None: - if TransferEngine is None: - raise RuntimeError("mooncake is not available") + try: + from mooncake.engine import TransferEngine # type: ignore + except ImportError as e: + raise ImportError( + "Please install mooncake by following the instructions at " + "https://github.com/kvcache-ai/Mooncake/blob/main/doc/en/build.md " # noqa: E501 + "to run vLLM with MooncakeConnector." + ) from e self.transfer_engine = TransferEngine() device_name = device_name if device_name is not None else "" ret_value = self.transfer_engine.initialize(hostname, "P2PHANDSHAKE", "ascend", device_name)