问题描述
配置Yolov5相关环境过程中需要安装pytorch以及cuda相应版本,过程中遇到了下载中断以及下载失败的问题

可以看到其中cuda-nvdisasm-12.1.5下载一半时下载停止了
cuda-compiler-11.7.1则是直接没有下载跳过了

后面也有类似情况出现
最后报错显示为
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://conda.anaconda.org/nvidia/win-64/cuda-nvdisasm-12.1.55-0.tar.bz2 Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

解决方案
1.更换源
首先需要确定是否已经更改通道,默认通道的下载速度比较慢,会导致上述情况的出现
打开C:\Users\ 你的个人用户名,目录下.condarc文件,使用记事本打开
将下面内容替换原文件的内容,保存后关闭文件。
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud2.下载完毕后重新输入指令
如果已经在换源情况下进行下载仍然出现上述情况,可以稍等片刻,确认网络通畅,再次执行下载的指令

正常情况会将之前没有下载成功的文件再次进行下载,已下载的文件不会重复

可以看到,我在第二次下载的时候已经可以将所有包都成功下载,但当中出现了一些问题:
ARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(143): Could not remove or rename C:\Users\jinni.conda\pkgs\cuda-nvdisasm-12.1.55-0\bin\nvdisasm.exe. Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(143): Could not remove or rename C:\Users\jinni.conda\pkgs\cuda-nvdisasm-12.1.55-0\bin\nvdisasm.exe. Please remove this file manually (you may need to reboot to free file handles)

InvalidArchiveError(“Error with archive C:\Users\jinni\.conda\pkgs\cuda-nvdisasm-12.1.55-0.tar.bz2. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nfailed with error: [Errno 13] Permission denied: ‘C:\\Users\\jinni\\.conda\\pkgs\\cuda-nvdisasm-12.1.55-0\\bin\\nvdisasm.exe’”)
InvalidArchiveError(“Error with archive C:\Users\jinni\.conda\pkgs\cuda-nvvp-12.1.55-0.tar.bz2. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nfailed with error: [Errno 13] Permission denied: ‘C:\\Users\\jinni\\.conda\\pkgs\\cuda-nvvp-12.1.55-0\\libnvvp\\plugins\\org.eclipse.gef_3.8.2.nvidia-qualifier.jar’”)
网上搜索全都是要去更改文件夹权限,改为用户完全控制,但个人是将文件下载在C盘中的,本身就已经是完全控制权限的文件夹
这里出现问题后,我前往报错提示的文件夹,找到了相应的文件

删除报错中出现的两个文件,重新执行指令

得到结果,一个成功下载,另一个下载失败的原因是超时,于是重新再执行指令,最后全部下载成功

至此,pytorch以及CUDA安装全部完成。
如果解决方案对您有帮助的话,烦请动动小手点个赞,您的支持就是我摸鱼更新的动力
















