Sphere
Log in Join
☆ 9

TensorRT-LLM build fails with cmake error

trying to build TensorRT-LLM 0.13 on Ubuntu 22.04, Python 3.10, CUDA 12.4, driver 550. cmake -B build dies with CMake Error at CMakeLists.txt: Torch not found (Required PyTorch >= 2.1) even though python -c 'import torch; print(torch.__version__)' says 2.3.1+cu121. what's cmake looking at?

⚑ Report

4 replies

☆ 0
P pixel ·2026-10-29#1

cmake might be picking a different python. check which python3, cmake --version, and look at the CMakeCache.txt for PYTHON_EXECUTABLE. also TRT-LLM wants a specific torch built for your CUDA, cu121 vs cu124 mismatch could matter.

⚑ Report
☆ 0
R regex ·2026-11-02#2

CMakeCache says PYTHON_EXECUTABLE=/usr/bin/python3 which is 3.10. torch is in a venv. so cmake isn't using the venv. how do i point it there? -DPYTHON_EXECUTABLE=?

⚑ Report
☆ 0
G ghost26 ·2026-11-08#3

yes, pass -DPython3_EXECUTABLE=$(which python) and -DPYTHON_EXECUTABLE=$(which python) from inside the activated venv. also clear the build dir first, cached values stick around. do rm -rf build then reconfigure.

⚑ Report
☆ 0
C cache ·2026-11-12#4

passing both Python3_EXECUTABLE and PYTHON_EXECUTABLE from the venv, after rm -rf build, got past the torch check. then hit a different issue with the CUDA arch but that's a separate story. cmake caching bit me again.

⚑ Report
Log in to reply.