【已解决】CondaError: Downloaded bytes did not match Content-Length

😎 作者介绍:我是程序员行者孙,一个热爱分享技术的制能工人。计算机本硕,人工制能研究生。公众号:AI Sun,视频号:AI-行者Sun
🎈 本文专栏:本文收录于《AI实战中的各种bug》系列专栏,相信一份耕耘一份收获,我会把日常学习中碰到的各种bug分享出来,不说废话,祝大家早日中稿cvpr
🤓 欢迎大家关注其他专栏,我将分享Web前后端开发、人工智能、机器学习、深度学习从0到1系列文章。
🖥 随时欢迎您跟我沟通,一起交流,一起成长、进步!

目录

问题描述

解决方案:

方案一

方案二

方案三


问题描述

CondaError: Downloaded bytes did not match Content-Length
  url: https://repo.anaconda.com/pkgs/main/linux-64/cudnn-7.1.5-cuda8.7_0.tar.bz2
  target_path: /home/yxc/miniconda3/pkgs/cudnn-7.1.5-cuda8.7_0.tar.bz2
  Content-Length: 2613982859
  downloaded bytes: 474631953


就像上面所述,用conda安装包下载包的时候由于网速问题,就会导致现有长度和下载的长度不匹配,然后导致timeout而终止

解决方案:

有三种,换源是最常见的

方案一

conda下载都是在国外服务器去下载,这就导致网速不稳定,bug频出,换源选一个离自己近的会好一点
清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
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.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --set show_channel_urls yes

 恢复默认源

conda config --remove-key channels

查看源

conda config --show

弄好之后你conda install 你想要下载的包即可 

方案二

 既然根本原因是timeout,那设置conda下载的timeout,然后再进行尝试,如果时长不够可以再设置大一点,这样下载所需的时候会变长,只是把下载的网络需求降低了一点

conda config --set remote_read_timeout_secs 800.0

弄好之后你conda install 你想要下载的包即可 

方案三

离线安装,网络极差,推荐这个方法,先把资源包下载下来,再conda install ...
 

  • 31
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 35
    评论
当出现"CondaError: Downloaded bytes did not match Content-Length"错误时,这意味着下载的文件字节数与预期的字节数不匹配。这可能是由于网络问题或下载源的问题导致的。 有几种解决方法可以尝试解决这个问题: 1. 配置镜像源:可以尝试更改Conda的下载源。可以通过设置conda的配置文件或使用conda的命令行参数来配置镜像源。选择一个稳定快速的镜像源可能会解决下载不匹配的问题。 2. 设置下载超时限制:有时下载超时也可能引起下载不匹配的问题。您可以尝试增加下载超时限制,使下载更充分,并减少下载中断的可能性。 3. 本地安装:如果您已经下载了所需的文件,您可以尝试手动安装,而不是依赖于Conda的下载功能。将下载的文件移动到正确的位置,并使用本地文件进行安装。 请根据您的具体情况选择适合您的解决方法,并尝试解决"CondaError: Downloaded bytes did not match Content-Length"错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [CondaError: Downloaded bytes did not match Content-Length](https://blog.csdn.net/qq_46092061/article/details/119141556)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [创建项目环境时报错CondaError: Downloaded bytes did not match Content-Length](https://blog.csdn.net/qq_44482186/article/details/127577677)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 35
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员行者孙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值