Hi,
I am a big fan of Conda and always use it to create virtual environments for my experiments since it can manage different versions of CUDA easily. Normally, I will install PyTorch with the recommended conda way, e.g. conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
. It has been working for years without any problem.
But recently, I have some RL experiments that need to run in a docker container which is based on nvidia/cudagl:11.4.2-devel-ubuntu20.04
that has a system-level cuda 11.4 install in it. Somehow, the conda install solution doesn’t work anymore. The torch.cuda.is_available
always return false. However, when I try to install PyTorch with pip, it seems like it also installs some cuda-related package and make torch.cuda.is_available
return true.
Now I am confused. If I have multiple cuda installation from different source, e.g. system-level, conda and pip, which cuda is actually in use? I see there are some post say one can use torch.version.cuda
to check the cuda version, but I feel it always returns the version that the code is compiled with, even when torch.cuda.is_available
returns false. How exactly is PyTorch indexing these dependencies?