简体   繁体   English

不完整的 PyTorch 与任何 CUDA 版本(模块“火炬”没有属性“cuda”)

[英]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.

相关问题 Pytorch:AttributeError:'function'对象没有属性'cuda' - Pytorch : AttributeError: 'function' object has no attribute 'cuda' Pytorch 模块 'torch' 没有属性 'logsoftmax' - Pytorch module 'torch' has no attribute 'logsoftmax' Pytorch 中 cat 的 Cuda 版本? - Cuda version for cat in Pytorch? RuntimeError:CUDA运行时错误(35):CUDA驱动程序版本对于CUDA运行时版本不足,位于Torch / csrc / cuda / Module.cpp:51 - RuntimeError: cuda runtime error (35) : CUDA driver version is insufficient for CUDA runtime version at torch/csrc/cuda/Module.cpp:51 pytorch,AttributeError:模块“火炬”没有属性“张量” - pytorch, AttributeError: module 'torch' has no attribute 'Tensor' AttributeError: 模块 'torch' 没有属性 'rfft' 与 PyTorch - AttributeError: module 'torch' has no attribute 'rfft' with PyTorch Torch 未在启用 CUDA 的情况下编译 - 重新安装 pytorch 不起作用 - Torch not compiled with CUDA enabled - reinstalling pytorch is not working Pytorch AssertionError:未在启用 CUDA 的情况下编译 Torch - Pytorch AssertionError: Torch not compiled with CUDA enabled PyTorch:AssertionError(“Torch 未在启用 CUDA 的情况下编译”) - PyTorch: AssertionError ("Torch not compiled with CUDA enabled") PyTorch torch_sparse 安装没有 CUDA - PyTorch torch_sparse installation without CUDA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM