SGLang Installation
- Method 1: Use the precompiled installation package released by the open-source community.
In this method, pip automatically parses dependencies based on the dependency metadata in the official SGLang release package. This method is suitable for scenarios where the default dependency combination of the open-source community is directly used. After the installation is complete, you need to verify the installation to ensure that both the PyTorch CUDA and sglang-kernel can be used properly.
1 2 3 4 5
export CUDA_HOME=/usr/local/cuda-13.0 export PATH=$CUDA_HOME/bin:$PATH export LD_LIBRARY_PATH=$CUDA_HOME/lib64:${LD_LIBRARY_PATH:-} python3 -m pip install --upgrade pip setuptools wheel python3 -m pip install sglang==0.5.10 sglang-kernel==0.4.1
- Method 2: Use the locally built installation package.
This method is used to reuse the PyTorch of the confirmed CUDA version. --no-deps does not skip dependency requirements. Instead, it changes the dependency installation to explicit management to prevent the PyTorch version from being replaced during dependency parsing when SGLang is installed. After the installation is complete, check again that both torch.backends.cuda.is_built() and torch.cuda.is_available() return True.
1 2 3 4 5 6 7 8 9 10 11 12
export CUDA_HOME=/usr/local/cuda-13.0 export PATH=$CUDA_HOME/bin:$PATH export LD_LIBRARY_PATH=$CUDA_HOME/lib64:${LD_LIBRARY_PATH:-} python3 -m pip install --upgrade pip setuptools wheel python3 -m pip install \ typing_extensions filelock fsspec jinja2 networkx sympy mpmath numpy packaging \ tqdm requests aiohttp fastapi uvicorn pydantic orjson pyzmq psutil pillow \ sentencepiece safetensors tokenizers transformers==5.3.0 pybase64 setproctitle \ partial_json_parser diskcache msgspec interegular lark pycountry pycryptodomex \ gguf openai anthropic prometheus-client uvloop watchfiles soundfile tiktoken IPython python3 -m pip install --no-deps sglang-kernel==0.4.1 python3 -m pip install --no-deps sglang==0.5.10
If you use a locally built wheel, replace the last two lines with the actual wheel file path.1 2
python3 -m pip install --force-reinstall --no-deps /path/to/sglang_kernel-0.4.1-*.whl python3 -m pip install --force-reinstall --no-deps /path/to/sglang-0.5.10-*.whl