torch.cuda.is_available()返回false,尽管安装了带有CUDA的pytorch

pobjuy32  于 2023-03-02  发布在  其他
关注(0)|答案(1)|浏览(233)

运行NVIDIA-SMI给出,

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 528.33       Driver Version: 528.33       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0  On |                  N/A |
| N/A   49C    P8    N/A /  N/A |    244MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

运行conda list pytorch给出,

# Name                    Version                   Build  Channel
pytorch                   1.13.1              py3.9_cpu_0    pytorch
pytorch-cuda              11.7                 h67b0de4_1    pytorch
pytorch-mutex             1.0                         cpu    pytorch

运行nvcc --version得到,

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:59:34_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0

作为参考,我有一个GeForce GTX 1050ti
我已经试过用conda和pip卸载pytorch,然后用,

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
dgiusagp

dgiusagp1#

所以我删除了所有与torch和cuda相关的内容(使用conda list torch和conda list cuda时发现的),然后使用重新安装
康达安装pytorch Torch 视觉 Torch 音频pytorch-cuda = 11.7-c pytorch-c英伟达
以及
conda安装-c水蟒cudatoolkit
而且现在起作用了

相关问题