From fa01e8e1351002ad0083857c7cb460c0bcfe5e4a Mon Sep 17 00:00:00 2001 From: PengGuanjun <1570320831@qq.com> Date: Thu, 25 Dec 2025 10:22:59 +0800 Subject: [PATCH 1/5] Install for 5090 GPU in the Ubuntu22.04.05 Install for 5090 GPU in the Ubuntu22.04.05 --- Install for 5090 GPU in the Ubuntu22.04.05.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Install for 5090 GPU in the Ubuntu22.04.05.md diff --git a/Install for 5090 GPU in the Ubuntu22.04.05.md b/Install for 5090 GPU in the Ubuntu22.04.05.md new file mode 100644 index 0000000..817eee4 --- /dev/null +++ b/Install for 5090 GPU in the Ubuntu22.04.05.md @@ -0,0 +1,145 @@ + + +# rdt2_5090_env for flash_attn-2.8.3+cu12torch2.9cxx11abiTRUE-cp312-cp312-linux_x86_64.whl + + +## 1. 更新软件包列表并安装预备工具 + +在终端中执行: + +```bash +sudo apt update +sudo apt install software-properties-common -y +``` + +## 2. 添加 `deadsnakes` PPA 并安装 Python 3.12 + +```bash +sudo add-apt-repository ppa:deadsnakes/ppa -y +sudo apt update +sudo apt install python3.12 python3.12-venv python3.12-dev -y +``` + +* `python3.12-venv`:用于创建虚拟环境的关键模块 +* `python3.12-dev`:包含开发头文件,后续某些 Python 包(如通过 `pip` 编译的包)可能会用到 + +## 3. 验证安装When preparing a PR, please ensure that you: + + Provide a clear and descriptive title and summary + Run pre-commit (after installing via pre-commit install) + Run ruff check . and ruff format . + Verify that all tests pass + + +安装完成后,运行以下命令检查: + +```bash +python3.12 --version +``` + +如果输出 `Python 3.12.x` 则表示安装成功。 + +## 4. 安装编译工具和依赖库 + +`ur-rtde` 是一个与 Universal Robots 进行通信的库,它包含需要编译的 C++ 扩展。要成功安装它,你的系统必须安装必要的**编译工具链**。 + +```bash +sudo apt update +sudo apt install -y cmake build-essential +``` + +安装 Boost 开发库(包含头文件和动态链接库),ur-rtde==1.5.6 需要: + +```bash +sudo apt install libboost-all-dev +``` + +## 5. 创建和激活虚拟环境 + +```bash +python3 -m venv rdt2_5090_env +source ~/pgj/RDT2_5090/rdt2/rdt2_5090_env/bin/activate # 激活环境 +``` + +## 6. 设置 CUDA 环境变量 + +```bash +export PATH=/usr/local/cuda-12.8/bin:$PATH +export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:$LD_LIBRARY_PATH +export CUDA_HOME=/usr/local/cuda-12.8 +``` + +## 7. 验证 CUDA 安装 + +检查 nvcc 版本: + +```bash +nvcc --version +``` +输出末尾应显示 "release 12.8, ..." + + + +## 8. 安装 PyTorch 和 Flash Attention + +从 [PyTorch 官网](https://pytorch.org/get-started/locally/) 获取安装命令: + +```bash +pip3 install torch torchvision +``` + +在 Python 中检查 PyTorch 使用的 CUDA 版本: + +```bash +python3.12 -c "import torch; print(torch.version.cuda)" +``` + +从 [Flash Attention GitHub Releases](https://github.com/Dao-AILab/flash-attention/releases) 下载并安装: + +```bash +pip3 install /home/ghzn/Downloads/flash_attn-2.8.3+cu12torch2.9cxx11abiTRUE-cp312-cp312-linux_x86_64.whl +``` + +## 9. 安装其他依赖 + +```bash +pip install -r requirements.txt +``` + +## 10. 验证 transformers 版本 + +确保安装了正确版本的 transformers (4.51.3): + +```bash +pip list | grep transformers +``` + +## 11. 部署到 Franka Research 3 的额外依赖 + +```bash +pip install -r requirements/franka_research_3.txt +``` + +## 注意事项 + +### franka_research_3.txt 调整建议 + +以下是 `franka_research_3.txt` 文件可能需要包含的包: + +``` +ur-rtde==1.5.6 +pynput==1.7.6 +imagecodecs==2023.9.18 +atomics==1.0.2 +minimalmodbus +zerorpc +openvr +``` + + + +1 + +2 + +3 From 2a787b2fba205e9427e1eaf2f098e4a09ccb9ded Mon Sep 17 00:00:00 2001 From: PengGuanjun <1570320831@qq.com> Date: Thu, 25 Dec 2025 10:41:25 +0800 Subject: [PATCH 2/5] Update Python commands to use pip3 and Python 3.12 Update Python commands to use pip3 and Python 3.12 --- Install for 5090 GPU in the Ubuntu22.04.05.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Install for 5090 GPU in the Ubuntu22.04.05.md b/Install for 5090 GPU in the Ubuntu22.04.05.md index 817eee4..6363b58 100644 --- a/Install for 5090 GPU in the Ubuntu22.04.05.md +++ b/Install for 5090 GPU in the Ubuntu22.04.05.md @@ -57,7 +57,7 @@ sudo apt install libboost-all-dev ## 5. 创建和激活虚拟环境 ```bash -python3 -m venv rdt2_5090_env +python3.12 -m venv rdt2_5090_env source ~/pgj/RDT2_5090/rdt2/rdt2_5090_env/bin/activate # 激活环境 ``` @@ -103,7 +103,7 @@ pip3 install /home/ghzn/Downloads/flash_attn-2.8.3+cu12torch2.9cxx11abiTRUE-cp31 ## 9. 安装其他依赖 ```bash -pip install -r requirements.txt +pip3 install -r requirements.txt ``` ## 10. 验证 transformers 版本 @@ -111,13 +111,13 @@ pip install -r requirements.txt 确保安装了正确版本的 transformers (4.51.3): ```bash -pip list | grep transformers +pip3 list | grep transformers ``` ## 11. 部署到 Franka Research 3 的额外依赖 ```bash -pip install -r requirements/franka_research_3.txt +pip3 install -r requirements/franka_research_3.txt ``` ## 注意事项 From 48eb2f174a183b178028b6a7e39a5f898a4ef3c3 Mon Sep 17 00:00:00 2001 From: PengGuanjun <1570320831@qq.com> Date: Thu, 25 Dec 2025 10:45:09 +0800 Subject: [PATCH 3/5] Update installation instructions for 5090 GPU Removed unnecessary PR preparation steps and clarified installation verification. --- Install for 5090 GPU in the Ubuntu22.04.05.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Install for 5090 GPU in the Ubuntu22.04.05.md b/Install for 5090 GPU in the Ubuntu22.04.05.md index 6363b58..3e6e21f 100644 --- a/Install for 5090 GPU in the Ubuntu22.04.05.md +++ b/Install for 5090 GPU in the Ubuntu22.04.05.md @@ -23,13 +23,7 @@ sudo apt install python3.12 python3.12-venv python3.12-dev -y * `python3.12-venv`:用于创建虚拟环境的关键模块 * `python3.12-dev`:包含开发头文件,后续某些 Python 包(如通过 `pip` 编译的包)可能会用到 -## 3. 验证安装When preparing a PR, please ensure that you: - - Provide a clear and descriptive title and summary - Run pre-commit (after installing via pre-commit install) - Run ruff check . and ruff format . - Verify that all tests pass - +## 3. 验证安装 安装完成后,运行以下命令检查: From 07667f28e5f1941ce7b8c86566268062ed8339da Mon Sep 17 00:00:00 2001 From: PengGuanjun <1570320831@qq.com> Date: Thu, 25 Dec 2025 16:21:58 +0800 Subject: [PATCH 4/5] Update installation instructions for vLLM Added images to illustrate the installation process and confirm successful installation of vLLM. --- ...71\351\205\215\345\256\211\350\243\205.md" | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 "\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" diff --git "a/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" "b/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" new file mode 100644 index 0000000..6f41214 --- /dev/null +++ "b/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" @@ -0,0 +1,162 @@ +# 解决 vLLM 安装问题:PyTorch 和 CUDA 版本匹配安装 + +--- + +## 🔧 问题分析 + +1. **PyTorch 未安装**:终端输出显示 `ModuleNotFoundError: No module named 'torch'` +2. **CUDA 版本不匹配**:你使用 CUDA 12.8,但安装 PyTorch 时未指定 CUDA 版本 +3. **vLLM 版本与 PyTorch 不兼容**:你提到 vLLM 0.9.2 需要 torch==2.7.0,但你安装了 2.9.1 + +--- + +## ✅ 完整解决方案 + +### 1. 安装正确的 PyTorch 版本(CUDA 12.8) + +```bash +# 确保激活你的虚拟环境 +source ~/pgj/RDT2_5090_Py312/RDT2_5090_Py312_env/bin/activate + +# 安装 PyTorch 2.9.1 with CUDA 12.8 +pip3.12 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 +``` + +### 2. 验证 PyTorch 安装 + +```bash +python3.12 -c "import torch; print(f'PyTorch: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}'); print(f'CUDA version: {torch.version.cuda}')" +``` + +**预期输出**: +``` +PyTorch: 2.9.1 +CUDA available: True +CUDA version: 12.8 +``` + +### 3. 安装 Flash Attention + +```bash +# 确保你有正确的预编译包 +pip3.12 install flash_attn-2.8.3+cu12torch2.9cxx11abiTRUE-cp312-cp312-linux_x86_64.whl +``` + +### 4. 安装 vLLM(关键步骤) + +```bash +cd ~/pgj/RDT2_5090_Py312/rdt2/vllm + +# 使用预编译版本安装,关键参数:--no-build-isolation +VLLM_USE_PRECOMPILED=1 uv pip install --editable . --no-build-isolation +``` + +> 💡 **为什么需要 `--no-build-isolation`?** +> 由于你已经安装了 PyTorch,这个参数告诉构建系统使用当前环境中的 PyTorch,而不是尝试重新安装。 + +### 5. 验证 vLLM 安装 + +```bash +python3.12 -c "from vllm import LLM; print('vLLM导入成功'); llm = LLM(model='facebook/opt-125m', gpu_memory_utilization=0.1); print('LLM初始化成功')" +``` + +**预期输出**: +``` +vLLM导入成功 +LLM初始化成功 +``` + +--- + +## 📌 重要说明 + +### 为什么 vLLM 0.9.2 与 PyTorch 2.9.1 不兼容? +- vLLM 0.9.2 确实要求 torch==2.7.0 +- 但你安装的是 vLLM 最新版本(不是 0.9.2),**最新 vLLM 版本支持 PyTorch 2.9.1** + +### 正确的 vLLM 版本选择 +- 如果你想使用最新功能,安装 vLLM 最新版本(0.14.0+) +- 如果必须使用 vLLM 0.9.2,需要安装 PyTorch 2.7.0: + ```bash + pip3.12 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 + ``` + +--- + +## 🔍 诊断命令 + +运行以下命令验证环境: + +```bash +# 1. PyTorch 版本 +python3.12 -c "import torch; print(f'PyTorch: {torch.__version__}')" + +# 2. CUDA 版本 +python3.12 -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}'); print(f'CUDA version: {torch.version.cuda}')" + +# 3. Flash Attention 版本 +pip3.12 show flash-attn + +# 4. vLLM 版本 +pip3.12 show vllm +``` + +--- + +## 🚫 常见错误及解决 + +| 错误 | 原因 | 解决方案 | +|------|------|----------| +| `ModuleNotFoundError: No module named 'torch'` | PyTorch 未安装 | 安装 `torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128` | +| `vLLM 0.9.2 requires torch==2.7.0` | 使用了不兼容的 vLLM 版本 | 升级 vLLM 或安装 PyTorch 2.7.0 | +| `CUDA version mismatch` | PyTorch 和 CUDA 版本不匹配 | 确保使用 `--index-url https://download.pytorch.org/whl/cu128` | + +--- + +## 💡 额外建议 + +1. **使用最新 vLLM**: + ```bash + # 确保你使用的是最新 vLLM 版本 + cd ~/pgj/RDT2_5090_Py312/rdt2/vllm + git pull origin main + ``` + +2. **使用正确版本的 Flash Attention**: + - 从 [Flash Attention Releases](https://github.com/Dao-AILab/flash-attention/releases) 下载与 PyTorch 2.9.1 和 CUDA 12.8 匹配的版本 + +3. **检查 nvcc 版本**: + ```bash + nvcc --version + ``` + 确保输出包含 `release 12.8`,否则需要安装 CUDA Toolkit 12.8 + +--- + +## ✅ 最终验证 + +```bash +# 1. 确认 PyTorch 安装 +python3.12 -c "import torch; print(f'PyTorch: {torch.__version__}'); print(f'CUDA version: {torch.version.cuda}')" + +# 2. 确认 vLLM 安装 +python3.12 -c "from vllm import LLM; print('vLLM is installed successfully'); llm = LLM(model='facebook/opt-125m'); print('vLLM model loaded successfully')" +``` + +如果看到 `vLLM is installed successfully` 和 `vLLM model loaded successfully`,说明安装成功! + +--- + +## 📌 总结 + +1. **先安装 PyTorch 2.9.1 with CUDA 12.8** +2. **然后安装 Flash Attention** +3. **最后使用 `--no-build-isolation` 安装 vLLM** + +这样就能解决 `ModuleNotFoundError: No module named 'torch'` 问题,成功安装 vLLM。 + +截图 2025-12-25 15-55-42 + +截图 2025-12-25 15-59-55 + +截图 2025-12-25 16-21-15 From 12cccfe9f4642bc0bff1bda4e4c1d6da6c7ddbc1 Mon Sep 17 00:00:00 2001 From: PengGuanjun <1570320831@qq.com> Date: Thu, 25 Dec 2025 16:43:30 +0800 Subject: [PATCH 5/5] Revise vLLM installation steps for clarity Updated installation instructions for vLLM to include cloning the repository and using an existing PyTorch installation. --- ...54\345\214\271\351\205\215\345\256\211\350\243\205.md" | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git "a/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" "b/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" index 6f41214..39c6f7c 100644 --- "a/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" +++ "b/\350\247\243\345\206\263 vLLM \345\256\211\350\243\205\351\227\256\351\242\230\357\274\232PyTorch \345\222\214 CUDA \347\211\210\346\234\254\345\214\271\351\205\215\345\256\211\350\243\205.md" @@ -45,10 +45,10 @@ pip3.12 install flash_attn-2.8.3+cu12torch2.9cxx11abiTRUE-cp312-cp312-linux_x86_ ### 4. 安装 vLLM(关键步骤) ```bash -cd ~/pgj/RDT2_5090_Py312/rdt2/vllm - -# 使用预编译版本安装,关键参数:--no-build-isolation -VLLM_USE_PRECOMPILED=1 uv pip install --editable . --no-build-isolation +git clone https://github.com/vllm-project/vllm.git +cd vllm +python3.12 use_existing_torch.py +VLLM_USE_PRECOMPILED=1 uv pip install --editable . --no-build-isolation --refresh --verbose -i https://pypi.tuna.tsinghua.edu.cn/simple ``` > 💡 **为什么需要 `--no-build-isolation`?**