[英]Incompletable PyTorch with any CUDA version (module 'torch' has no attribute 'cuda')
I have NVidia 1080TI, Ubuntu x64, and Python 3.6.9 installed.我安装了 NVidia 1080TI、Ubuntu x64 和 Python 3.6.9。 I was trying to launch PyTorch with command
我试图用命令启动 PyTorch
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.我尝试更新 PyTorch 并安装支持 CUDA 11.0 的最新版本 1.7.0。 After that, I noticed some version discrepancies.
在那之后,我注意到一些版本差异。
nvidia-smi
shows CUDA version 11.0 but nvcc -V
shows 9.1. nvidia-smi
显示 CUDA 版本 11.0 但nvcc -V
显示 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).另外,我使用
cat /usr/local/cuda/version.txt
检查 CUDA 版本但得到错误: cat: /usr/local/cuda/version.txt: No such file or directory
I installed CUDA driver 450.33 after full nvidia清除但错误仍然存在,并且nvcc -V
仍然显示 9.1 版本(也重新启动后)。
One more option I addressed to is conda installation but it didn't help.我提出的另一个选择是 conda 安装,但它没有帮助。 What I can do to resolve the problem?
我能做些什么来解决这个问题?
As a result, I had a file named torch.py
in my home directory.结果,我的主目录中有一个名为
torch.py
的文件。 After the renaming problem was solved.改名问题解决后。
Thanks.谢谢。 Maybe my answer will be helpful to someone.
也许我的回答会对某人有所帮助。
I had the same problem and reinstalled it several times, only to find that my script was named torch.py我有同样的问题并重新安装了几次,结果发现我的脚本被命名为torch.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.