2021-06-30pytorch1.8.0不支持cuda10.1

安装pytorch前一定查好cuda与torch的对应版本号, torch和torchvision对应版本鸭!!!

(py3.8+torch1.8) administrator@delltwo:~/storage2/xxy/project/pkgs$ pip install torch-1.8.0+cu101-cp38-cp38-linux_x86_64.whl Processing ./torch-1.8.0+cu101-cp38-cp38-linux_x86_64.whl
Requirement already satisfied: typing-extensions in /home/administrator/anaconda3/envs/py3.8+torch1.8/lib/python3.8/site-packages (from torch==1.8.0+cu101) (3.10.0.0)
Requirement already satisfied: numpy in /home/administrator/anaconda3/envs/py3.8+torch1.8/lib/python3.8/site-packages (from torch==1.8.0+cu101) (1.21.0)
Installing collected packages: torch
Successfully installed torch-1.8.0+cu101
(py3.8+torch1.8) administrator@delltwo:~/storage2/xxy/project/pkgs$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.8.0+cu101'
>>> torch.cuda.is_aa vail    
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch.cuda' has no attribute 'is_a'
>>> torch.cuda.is_available()
True
>>> 

(py3.8+torch1.8) administrator@delltwo:~/storage2/xxy/project/pkgs$ install torchvision-0.9.1+cu101-cp38-cp38-linux_x86_64.whl 
install: missing destination file operand after 'torchvision-0.9.1+cu101-cp38-cp38-linux_x86_64.whl'
Try 'install --help' for more information.
(py3.8+torch1.8) administrator@delltwo:~/storage2/xxy/project/pkgs$ pip install torchvision-0.9.1+cu101-cp38-cp38-linux_x86_64.whl 
Processing ./torchvision-0.9.1+cu101-cp38-cp38-linux_x86_64.whl
Collecting torch==1.8.1
  Using cached torch-1.8.1-cp38-cp38-manylinux1_x86_64.whl (804.1 MB)
Requirement already satisfied: pillow>=4.1.1 in /home/administrator/anaconda3/envs/py3.8+torch1.8/lib/python3.8/site-packages (from torchvision==0.9.1+cu101) (8.2.0)
Requirement already satisfied: numpy in /home/administrator/anaconda3/envs/py3.8+torch1.8/lib/python3.8/site-packages (from torchvision==0.9.1+cu101) (1.21.0)
Requirement already satisfied: typing-extensions in /home/administrator/anaconda3/envs/py3.8+torch1.8/lib/python3.8/site-packages (from torch==1.8.1->torchvision==0.9.1+cu101) (3.10.0.0)
Installing collected packages: torch, torchvision
  Attempting uninstall: torch
    Found existing installation: torch 1.8.0+cu101
    Uninstalling torch-1.8.0+cu101:
      Successfully uninstalled torch-1.8.0+cu101
Successfully installed torch-1.8.1 torchvision-0.9.1+cu101
(py3.8+torch1.8) administrator@delltwo:~/storage2/xxy/project/pkgs$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.8.1+cu102'
>>> torch.__version__>>> import torch     >>> torch.cuda.is_available()>>> import torch             
>>> torch.cuda.is_available()
/home/administrator/anaconda3/envs/py3.8+torch1.8/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at  /pytorch/c10/cuda/CUDAFunctions.cpp:109.)
  return torch._C._cuda_getDeviceCount() > 0
False
>>> 

torch和torchvision版本与cuda版本不配套导致
https://github.com/pytorch/vision#installation可查看torch和torchvision对应版本
在这里插入图片描述可以看到torch1.8.0对应的torchvision是0.9.0,但是https://pytorch.org/get-started/previous-versions/pytorch官方
在这里插入图片描述pytorch1.8.0版本不支持cuda10.1
所以需要降低torch版本
在这里插入图片描述

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值