| name | vllm-setup |
| description | Install vLLM, configure environment, resolve dependency issues |
| triggers | ["When user wants to install vLLM","When user encounters installation errors","When user needs to configure GPU drivers or CUDA","When user wants to install vLLM on specific hardware (ROCm, NPU, XPU, CPU)"] |
vllm-setup
Overview
vLLM installation varies by hardware backend and use case. This skill covers installation methods, environment configuration, and troubleshooting common setup issues.
Prerequisites
- Python 3.9 - 3.12
- CUDA 11.8+ or ROCm 5.0+ (for GPU inference)
- 8GB+ available disk space
- For CUDA: NVIDIA driver 450.80.02+
Main Workflow
Step 1: Choose Installation Method
Option A: pip (Recommended for most users)
pip install vllm
pip install vllm --extra-index-url https://download.pytorch.org/whl/cu118
Option B: uv (Fastest, for development)
pip install uv
uv pip install vllm
Option C: Source (For development or latest features)
git clone https://github.com/vllm-project/vllm.git
cd vllm
pip install -e .
Option D: Docker
docker run --runtime nvidia --gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-p 8000:8000 \
vllm/vllm-openai:latest
docker run --runtime nvidia --gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-p 8000:8000 \
vllm/vllm-openai:latest \
--model meta-llama/Llama-2-7b-hf
Step 2: Verify Installation
python -c "import vllm; print(vllm.__version__)"
python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"
python -c "from vllm import LLM; print('vLLM imported successfully')"
Step 3: Configure Hugging Face (for gated models)
pip install huggingface_hub
huggingface-cli login
export HF_TOKEN=your_token_here
Hardware-Specific Installation
AMD ROCm
pip install vllm --extra-index-url https://download.pytorch.org/whl/rocm6.1
rocm-smi
Intel XPU
pip install vllm-xpu
export VLLM_TARGET_DEVICE=xpu
Intel CPU
pip install vllm --extra-index-url https://download.pytorch.org/whl/cpu
export VLLM_TARGET_DEVICE=cpu
pip install -e .
Neural Processing Unit (NPU)
export VLLM_TARGET_DEVICE=npu
pip install vllm
Common Patterns
Pattern 1: Virtual Environment Setup
python -m venv vllm-env
source vllm-env/bin/activate
pip install vllm
Pattern 2: Requirements File Setup
# requirements.txt
vllm>=0.5.0
transformers>=4.40.0
accelerate>=0.25.0
pip install -r requirements.txt
Pattern 3: Development Setup
git clone https://github.com/vllm-project/vllm.git
cd vllm
pip install -e ".[dev]"
pre-commit install
Troubleshooting
Problem: CUDA Out of Memory during installation
Solution:
Install without building CUDA extensions (CPU-only first):
export VLLM_SKIP_CUDA_BUILD=1
pip install vllm --no-build-isolation
Problem: ImportError: cannot import name '_C'
Solution:
The CUDA extensions failed to build. Reinstall:
pip uninstall vllm -y
rm -rf ~/.cache/pip/wheels/vllm*
pip install vllm
Problem: Version conflict with PyTorch
Solution:
python -c "import torch; print(torch.__version__)"
pip install vllm==0.5.0
pip install torch --upgrade --index-url https://download.pytorch.org/whl/cu121
Problem: Permission denied errors
Solution:
pip install --user vllm
python -m venv vllm-env
source vllm-env/bin/activate
pip install vllm
Problem: Slow model download
Solution:
export HF_ENDPOINT=https://hf-mirror.com
export HF_HOME=/path/to/large/disk
References