@@ -61,9 +61,12 @@ def embed_commit_hash():
6161
6262VLLM_TARGET_DEVICE = envs .VLLM_TARGET_DEVICE
6363
64- # vLLM only supports Linux platform
65- assert sys .platform .startswith (
66- "linux" ), "vLLM only supports Linux platform (including WSL)."
64+ if not sys .platform .startswith ("linux" ):
65+ logger .warning (
66+ "vLLM only supports Linux platform (including WSL). "
67+ "Building on %s, "
68+ "so vLLM may not be able to run correctly" , sys .platform )
69+ VLLM_TARGET_DEVICE = "empty"
6770
6871MAIN_CUDA_VERSION = "12.1"
6972
@@ -231,6 +234,10 @@ def build_extensions(self) -> None:
231234 subprocess .check_call (["cmake" , * build_args ], cwd = self .build_temp )
232235
233236
237+ def _no_device () -> bool :
238+ return VLLM_TARGET_DEVICE == "empty"
239+
240+
234241def _is_cuda () -> bool :
235242 has_cuda = torch .version .cuda is not None
236243 return (VLLM_TARGET_DEVICE == "cuda" and has_cuda
@@ -350,7 +357,9 @@ def find_version(filepath: str) -> str:
350357def get_vllm_version () -> str :
351358 version = find_version (get_path ("vllm" , "version.py" ))
352359
353- if _is_cuda ():
360+ if _no_device ():
361+ version += "+empty"
362+ elif _is_cuda ():
354363 cuda_version = str (get_nvcc_cuda_version ())
355364 if cuda_version != MAIN_CUDA_VERSION :
356365 cuda_version_str = cuda_version .replace ("." , "" )[:3 ]
@@ -404,7 +413,9 @@ def _read_requirements(filename: str) -> List[str]:
404413 resolved_requirements .append (line )
405414 return resolved_requirements
406415
407- if _is_cuda ():
416+ if _no_device ():
417+ requirements = _read_requirements ("requirements-cuda.txt" )
418+ elif _is_cuda ():
408419 requirements = _read_requirements ("requirements-cuda.txt" )
409420 cuda_major , cuda_minor = torch .version .cuda .split ("." )
410421 modified_requirements = []
@@ -453,6 +464,9 @@ def _read_requirements(filename: str) -> List[str]:
453464 ext_modules = []
454465 package_data ["vllm" ].append ("*.so" )
455466
467+ if _no_device ():
468+ ext_modules = []
469+
456470setup (
457471 name = "vllm" ,
458472 version = get_vllm_version (),
0 commit comments