I have NVidia 1080TI, Ubuntu x64, and Python 3.6.9 installed. I was trying to launch PyTorch with command
import torch print(torch.cuda.is_available) and expected to see 'True' but met the error:
AttributeError: module 'torch' has no attribute 'cuda' I tried to update PyTorch and install the last version 1.7.0 with CUDA 11.0 support. After that, I noticed some version discrepancies. nvidia-smi shows CUDA version 11.0 but nvcc -V shows 9.1. Also, I used cat /usr/local/cuda/version.txt to check CUDA version but got the error: cat: /usr/local/cuda/version.txt: No such file or directory I installed CUDA driver 450.33 after fully nvidia purging but the error remains and nvcc -V still shows 9.1 version (after reboot also).
One more option I addressed to is conda installation but it didn't help. What I can do to resolve the problem?
nvccversion discrepancy is a red herring. Pytorch does not use the systems CUDA at all. When installed with conda or pip it ships with its own copy of CUDA. You don't even need to install CUDA on your system to use pytorch with CUDA support.nvidia-smijust displays the latest version of CUDA compatible with your graphics drivers, the version displayed here is purely a function of your graphics driver and doesn't imply anything about the CUDA toolkit on your system.conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch(based on widget from pytorch.org).