How to find CUDA path inside venv

Hello,

I am installing a project that asks to set environment variable CUDA_HOME.
I have installed Pytorch inside venv using:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

How would I know CUDA path, especiallt that nvcc is not installed?

Ali

The PyTorch binaries ship with their own CUDA runtime dependencies, not with a full CUDA toolkit including the compiler.
Since a project requires CUDA_HOME I assume it’s asking for a full CUDA Toolkit, which you would need to install separately.

1 Like

@ptrblck
Would it be fine to install CUDA via conda first:
conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit

then follow instructions here to build torch:

I’m unsure why you want to build PyTorch from source as it seems a 3rd party package complains about the missing CUDA compiler.
Also, cuda-toolkit might just ship the runtime and headers.

The library I am using relies on pytorch and CUDA…
You mentioned that I might need to install full CUDA Toolkit.
I am planning to do that via:
conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit

then, I need to install pytorch next. I assumed that I cannot simply install the binary via pip so I have to build it from source.

Did I get things wrong?

Yes, and you can download it from e.g. here.

This won’t work as it’s the CUDA runtime conda package and would not contain the compiler.

You still can install PyTorch from source assuming the error pointing to the missing CUDA_HOME comes from a 3rd party package.