在linux上执行pytorch程序时,代码要求pytorch版本>1.0,但安装后,由于cuda版本太低,导致运行出现错误,提示
AssertionError:
The NVIDIA driver on your system is too old (found version 10000).
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
由于多人使用一台服务器,担心更新cuda后会造成其他问题,于是选择在不更新cuda的情况下,安装合适版本的pytorch
查看cuda版本:
cat /usr/local/cuda/version.txt
查看当前pytorch是否支持当前机器的cuda命令为
import torch
print(torch.__version__)
print(torch.cuda.is_available())
若打印True,则可以,False则不支持
打开https://pytorch.org后,有相关提示不同平台,以及cuda对应的pytorch指令
然而,我的cuda版本为9.0,上面没有对应的,选择None后安装的pytorch也不能使用
在网上找了一番后,相关博客给出cuda
http://download.pytorch.org/whl/cu90/torch-1.1.0-cp36-cp36m-linux_x86_64.whl
亲测这个版本的torch1.0.0可支持cuda9.0
但如果还要安装torchvision,系统就会再次更新pytorch,又回导致不可用,因此要指定torchvision安装版本,如果不想更新torch的话 pip install torchvision==0.1.6
参考:
https://blog.csdn.net/weixin_36757190/article/details/100006182
https://blog.csdn.net/weixin_39965184/article/details/107363827
https://blog.csdn.net/hfutzhouyonghang/article/details/100884018/