卸载torch并更新版本,torch-gpu的下载安装--亲测有效!!

以前一直抱怨实验室的cuda版本,以前是10.1,导致只能安装最低配版本的torch,也就是torch1.8.1,现在内核版本和驱动都更新了,变成了cuda11.4,以前的环境都没办法跑代码,只能重新进行卸载安装。

1、查看CUDA版本

nvidia-smi

2、激活对应环境,查看torch版本

conda activate your_environment_name
conda list

这里对应的torch、torch-geometric等都是符合cuda10.1的版本,需要都进行卸载 

3、进行卸载

pip uninstall torch torchaudio torchvision
pip uninstall torch-geometric torch-scatter torch-sparse torch-cluster torch-spline-conv

 4、进行torch gpu版本的安装

方法一:直接使用命令进行安装(我这里成功了)

最后的cu113代表cuda版本,我这里没有找到cu114,因此选择cu113进行向下兼容

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

方法二:指定版本安装(后续torch_geometric用到)

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 -f https://download.pytorch.org/whl/torch_stable.html

方法三:自行下载对应版本的安装包进行安装

下载地址:https://download.pytorch.org/whl/torch_stable.html 

 

5、查看torch gpu版本是否可用

出现True代表没问题,就可以快乐跑代码啦~

torch.cuda.is_available()

6、进行torch_geometric的安装

详细安装参考我的另一篇博客

torch_geometric踩坑实战--安装与运行 亲测有效!!_attributeerror: module 'torch' has no attribute 's-CSDN博客

 安装依赖

pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-1.12.1+cu113.html

安装torch_geometric

pip install torch_geometric

都看到这里啦~给个小心心♥♥呗~

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值