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

使用dvc import导入GitHub文件时遭遇urllib3未定义错误求助

解决DVC导入时"name 'urllib3' is not defined"错误

问题场景

尝试通过DVC导入GitHub仓库中的压缩数据,执行命令:

dvc import https://github.com/thursday/myrepo xyz.zip -o data/myrepo/xyz.zip

目标文件实际为https://github.com/Krishnamugundh/vocal_disease_prediction_app/blob/data/voice-icar-federico-ii-database-1.0.0.zip,但收到错误:

ERROR: failed to import 'xyz' - SCM error: Failed to clone repo 'https://github.com/thursday/myrepo' to 'C:\Users\thursday\AppData\Local\Temp\tmp5pjwggyjdvc-clone': name 'urllib3' is not defined

已更新DVC至3.51.2版本、urllib3至2.0.2版本,问题仍未解决。

解决方案

  • 检查Python环境一致性:确认DVC使用的Python环境与安装urllib3的环境一致。执行dvc --version查看DVC关联的Python路径,再用where python(Windows)或which python(Linux/macOS)对比,确保用对应环境的pip安装依赖。
  • 重新安装DVC完整依赖:卸载当前DVC后,安装包含Git支持的完整版本,确保依赖拉取完整:
    pip uninstall dvc -y
    pip install dvc[git]
    
  • 降级urllib3版本:urllib3 2.x系列可能与DVC存在兼容性问题,尝试降级到稳定的1.26.x版本:
    pip install urllib3==1.26.18
    
  • 验证临时目录权限:确保当前用户对C:\Users\thursday\AppData\Local\Temp目录有读写权限,DVC克隆仓库需在该目录创建临时文件。
  • 修正导入命令的仓库地址:目标文件属于https://github.com/Krishnamugundh/vocal_disease_prediction_app仓库,且位于data分支,正确命令应为:
    dvc import https://github.com/Krishnamugundh/vocal_disease_prediction_app voice-icar-federico-ii-database-1.0.0.zip -o data/myrepo/xyz.zip --rev data
    

内容的提问来源于stack exchange,提问作者Thursday U

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 19:42:10