網(wǎng)站首頁 編程語言 正文
2022.12.8在win+cuda11.8下安裝最新Pytorch GPU版時(shí)遇到包不兼容的問題,該文記錄安裝的整個(gè)流程
一、按照cuda版本在官網(wǎng)找命令
Pytorch官網(wǎng)命令如下
在win、cuda11.8下安裝GPU版Pytorch
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
分析該命令,-c后面為安裝包的源,-c pytorch表示使用官方源,可能出現(xiàn)速度慢等問題
二、換源
因此一般先將conda切換清華源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/
三、Bug描述
換源后去掉-c執(zhí)行命令如下
conda install pytorch torchvision torchaudio pytorch-cuda=11.7
報(bào)錯(cuò)包不兼容,出現(xiàn)沖突
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
Examining torchaudio: 43%|██████████████████████████████████████████████▎ | 3/7 [00:22<00:24, 6.10s/it]/failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- torchaudio -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|3.4.*']
Your python: python=3.7
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package typing conflicts for:
torchvision -> typing_extensions -> typing[version='>=3.7.4']
pytorch -> typing_extensions -> typing[version='>=3.7.4']
Package pytorch conflicts for:
torchaudio -> pytorch[version='1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0']
torchvision -> pytorch[version='1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0|1.5.1|1.5.0|1.4.0|1.3.1|1.3.0|1.2.0|>=1.1.0|>=1.0.0|>=0.4']
Package pytorch-cuda conflicts for:
pytorch -> pytorch-cuda[version='>=11.6,<11.7|>=11.7,<11.8']
torchaudio -> pytorch-cuda[version='11.6.*|11.7.*']
torchvision -> pytorch==1.13.0 -> pytorch-cuda[version='>=11.6,<11.7|>=11.7,<11.8']
torchaudio -> pytorch==1.13.0 -> pytorch-cuda[version='>=11.6,<11.7|>=11.7,<11.8']
torchvision -> pytorch-cuda[version='11.6.*|11.7.*']
Package requests conflicts for:
python=3.7 -> pip -> requests
torchvision -> request
四、解決方法
參考之前安裝成功的命令為
conda install pytorch torchvision torchaudio cudatoolkit=11.3
嘗試執(zhí)行
conda install pytorch torchvision torchaudio cudatoolkit=11.7
報(bào)錯(cuò)找不到包
PackagesNotFoundError: The following packages are not available from current channels:
- cudatoolkit=11.7
推測(cè)原因可能是cuda11.7將cudatoolkit=11.7換為pytorch-cuda=11.7,而-c nvidia為pytorch-cuda的源。
執(zhí)行如下命令成功安裝
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c nvidia
五、查看是否使用GPU
import torch
use_gpu = torch.cuda.is_available()
print(use_gpu)
print("devices count:", torch.cuda.device_count())
輸出
True
devices count: 1
總結(jié)
原文鏈接:https://blog.csdn.net/JamesShuker/article/details/128257519
相關(guān)推薦
- 2022-06-29 docker容器狀態(tài)轉(zhuǎn)換管理命令實(shí)例詳解_docker
- 2022-09-13 GO語言包管理工具go?mod以及包詳解_Golang
- 2023-01-17 Keras中Sequential模型和Functional模型的區(qū)別及說明_python
- 2021-12-05 解析Redis?數(shù)據(jù)結(jié)構(gòu)之簡(jiǎn)單動(dòng)態(tài)字符串sds_Redis
- 2022-04-23 通過CSS的sticky屬性 重新回顧 position
- 2022-04-27 Python?Pandas學(xué)習(xí)之Pandas數(shù)據(jù)結(jié)構(gòu)詳解_python
- 2022-01-03 當(dāng)前時(shí)間與新年倒計(jì)時(shí)
- 2023-03-03 詳解Flask框架中Flask-Login模塊的使用_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支