I installed PyTorch using conda in a fresh environment on my Manjaro linux OS as described in “Get Started” / “Start Locally”, using the given command:
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
This worked fine, given that torch.cuda.is_available()
returns True
and for testing, I successfully trained a model on my GPU (RTX 4090).
However, it looks like I can’t use custom extensions, such as the CUDA kernel provided for swin transformers. If I run the setup.py
, I get the error:
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
I also recognize that nvcc
is not available in the shell.
I’ve read quite a lot of postings across different forums which seem to be related, but couldn’t find a solution for this problem.
It looks like I have to install CUDA separately, but I also need to have the version match with the version of PyTorch. If I install CUDA using the package manager of Manjaro (and not via conda), the versions don’t match and it doesn’t work.
How can I install both PyTorch and CUDA with conda to make custom extensions work?