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?
As a result, I had a file named torch.py in my home directory. After the renaming problem was solved.
Thanks. Maybe my answer will be helpful to someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With