在Colab运行GroundingDINO官方笔记本时遇python setup.py develop执行失败求解决
解决GroundingDINO在Colab中安装失败的问题
操作场景
执行官方Colab安装代码时出错,运行的代码如下:
%cd {HOME} !git clone https://github.com/IDEA-Research/GroundingDINO.git %cd {HOME}/GroundingDINO !pip install -q -e . !pip install -q roboflow
错误详情
安装过程中出现以下报错:
/content Cloning into 'GroundingDINO'... remote: Enumerating objects: 463, done. remote: Total 463 (delta 0), reused 0 (delta 0), pack-reused 463 (from 1) Receiving objects: 100% (463/463), 12.91 MiB | 42.50 MiB/s, done. Resolving deltas: 100% (221/221), done. /content/GroundingDINO Preparing metadata (setup.py) ... done ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.8/46.8 kB 3.1 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 207.2/207.2 kB 13.6 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 256.2/256.2 kB 25.0 MB/s eta 0:00:00 error: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> See above for output. Note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> See above for output. Note: This error originates from a subprocess, and is likely not a problem with pip. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.7/88.7 kB 4.8 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.8/66.8 kB 6.8 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.9/49.9 MB 14.8 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 76.8 MB/s eta 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 120.0 MB/s eta 0:00:00
解决步骤
- 更新pip到最新版本:旧版pip对
setup.py develop兼容性较差,先执行:!pip install --upgrade pip - 安装编译依赖:Colab默认可能缺少部分编译工具,补充安装:
!apt-get update && apt-get install -y gcc g++ build-essential - 切换到稳定版本分支:最新主分支可能存在未修复bug,克隆时指定稳定版本(如v0.1.0):
%cd {HOME} !git clone -b v0.1.0 https://github.com/IDEA-Research/GroundingDINO.git %cd {HOME}/GroundingDINO - 重新执行安装命令:
!pip install -e . !pip install roboflow - 备选方案:使用预构建包:若上述方法仍失败,直接安装PyPI预编译包:
!pip install groundingdino !pip install roboflow
内容的提问来源于stack exchange,提问作者Encipher
相关产品推荐
相关产品推荐

