在使用conda和pip安装某仓库环境的时候报错:

1
2
3
4
5
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 30 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

看不懂,干脆问ai,然后在ai的答案里面找到了解药。

我选择的方法是把http更换成ssh(毕竟昨天刚解决ssh的连接问题

1
2
# 尝试SSH协议(需提前配置SSH key)
git config --global url."[email protected]:".insteadOf "https://github.com/"

然后就,解决了。


下面是 DeepSeek 的回答,其中,我采取了更换协议的方法。

在安装过程中出现Git相关的网络错误通常与仓库克隆问题或网络连接不稳定有关。以下是分步解决方案:

  1. 升级Git和Pip

    1
    2
    3
    4
    5
    6
    # 更新Git配置(针对大仓库)
    git config --global http.postBuffer 524288000
    git config --global core.compression 0
    # 升级pip和工具链

    pip install --upgrade pip setuptools wheel
  2. 更换Git协议(二选一)

    1
    2
    3
    4
    5
    # 尝试SSH协议(需提前配置SSH key)
    git config --global url."[email protected]:".insteadOf "https://github.com/"

    # 或强制使用HTTP/1.1
    git config --global http.version HTTP/1.1
  3. 手动克隆仓库(关键步骤)

    1
    2
    3
    4
    5
    # 先单独克隆主仓库(替换为实际仓库URL)
    git clone https://github.com/yourusername/llava-next.git
    cd llava-next
    # 初始化子模块(如果有)
    git submodule update --init --recursive
  4. 使用镜像源安装

    1
    2
    3
    4
    # 在项目目录中运行(已手动克隆后)
    pip install -e ".[train]" \
    -i https://pypi.tuna.tsinghua.edu.cn/simple \
    --trusted-host pypi.tuna.tsinghua.edu.cn
  5. 若仍遇到包下载问题

    1
    2
    # 对特定包使用镜像源
    pip install torch torchvision -i https://mirrors.aliyun.com/pypi/simple/

其他注意事项:

  • 确保已安装构建依赖:sudo apt-get install -y git python3-dev python3-venv
  • 如果使用代理,请配置git代理:git config --global http.proxy your_proxy:port
  • 尝试在网络状况较好的时段进行操作
  • 对于特别大的仓库,可添加--depth 1参数进行浅克隆

如果问题依旧存在,请提供:

  1. 完整的安装命令输出
  2. pip -Vgit --version 的版本信息
  3. 是否使用特殊网络环境(公司代理/VPN等)

这样可以进一步诊断具体问题原因。