diff --git a/vllm/utils.py b/vllm/utils.py index 3bcf240d5e501..9b5f5589340e2 100644 --- a/vllm/utils.py +++ b/vllm/utils.py @@ -344,8 +344,11 @@ def is_tpu() -> bool: @lru_cache(maxsize=None) def is_xpu() -> bool: - from importlib.metadata import version - is_xpu_flag = "xpu" in version("vllm") + from importlib.metadata import PackageNotFoundError, version + try: + is_xpu_flag = "xpu" in version("vllm") + except PackageNotFoundError: + return False # vllm is not build with xpu if not is_xpu_flag: return False