You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu系统下Mamba安装超时错误的修复方法求助

问题分析与解决方案

错误原因

  1. 网络访问受限:默认的conda-forge源服务器在海外,国内访问时带宽不足、延迟高,导致下载速率低于Mamba/Conda的最低速率阈值(默认30字节/秒),触发超时。
  2. 本地缓存失效:之前缓存的包文件损坏或版本过期,系统判定无效后需要重新下载全部201个包,大体积的下载量进一步加剧了网络压力。
  3. 超时配置过严:Mamba/Conda默认的超时时间和最低传输速率设置较为严格,在网络波动时容易触发下载中断。

修复方法

1. 更换国内镜像源

替换默认的conda-forge源为国内镜像,大幅提升下载速度:

# 清除现有源配置
conda config --remove-key channels
conda config --remove-key default_channels

# 添加清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/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/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/

# 设置搜索时显示通道地址
conda config --set show_channel_urls yes

2. 调整超时与传输速率参数

放宽Mamba/Conda的网络限制,避免因短暂波动触发超时:

# 增大连接超时时间(单位:秒)
conda config --set remote_connect_timeout_secs 120
# 增大读取超时时间
conda config --set remote_read_timeout_secs 300
# 增加重试次数
conda config --set remote_max_retries 10
# 降低最低传输速率阈值(比如设为100字节/秒)
conda config --set remote_min_rate 100

3. 清理无效缓存

删除损坏的缓存文件,让系统重新下载有效包:

mamba clean --all -y

4. 分批安装依赖

如果一次性下载3GB压力过大,可以拆分安装步骤,先安装核心依赖,再补充其他包:

# 先创建空环境并安装基础依赖
mamba create -n your_env_name python=3.xx
# 再逐步安装其他包
mamba install -n your_env_name pkg1 pkg2 ...

5. 检查网络环境

  • 确认当前网络是否稳定,必要时切换到有线网络或更优质的网络环境。
  • 检查是否有防火墙、代理工具限制了Mamba/Conda的网络访问,暂时关闭此类工具后重试。

内容的提问来源于stack exchange,提问作者Akila Induranga

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 18:33:18