(vlmgame) hxj@hxj:~/VLN-game/Grounded-Segment-Anything$ pip install -e GroundingDINO Obtaining file:///home/hxj/VLN-game/Grounded-Segment-Anything/GroundingDINO Preparing metadata (setup.py) ... done Requirement already satisfied: torch in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (2.1.0) Requirement already satisfied: torchvision in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (0.16.0) Requirement already satisfied: transformers in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (4.55.4) Requirement already satisfied: addict in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (2.4.0) Requirement already satisfied: yapf in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (0.40.2) Requirement already satisfied: timm in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (1.0.19) Requirement already satisfied: numpy in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (2.1.3) Requirement already satisfied: opencv-python in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (4.12.0.88) Requirement already satisfied: supervision in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (0.26.1) Requirement already satisfied: pycocotools in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from groundingdino==0.1.0) (2.0.10) Requirement already satisfied: scipy>=1.10.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (1.15.3) Requirement already satisfied: matplotlib>=3.6.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (3.10.0) Requirement already satisfied: pyyaml>=5.3 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (6.0.2) Requirement already satisfied: defusedxml>=0.7.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (0.7.1) Requirement already satisfied: pillow>=9.4 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (11.1.0) Requirement already satisfied: requests>=2.26.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (2.32.3) Requirement already satisfied: tqdm>=4.62.3 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from supervision->groundingdino==0.1.0) (4.67.1) Requirement already satisfied: contourpy>=1.0.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (1.3.1) Requirement already satisfied: cycler>=0.10 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (4.55.3) Requirement already satisfied: kiwisolver>=1.3.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (1.4.8) Requirement already satisfied: packaging>=20.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (24.2) Requirement already satisfied: pyparsing>=2.3.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (3.2.0) Requirement already satisfied: python-dateutil>=2.7 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (2.9.0.post0) Requirement already satisfied: six>=1.5 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib>=3.6.0->supervision->groundingdino==0.1.0) (1.17.0) Requirement already satisfied: charset-normalizer<4,>=2 in /home/hxj/.local/lib/python3.10/site-packages (from requests>=2.26.0->supervision->groundingdino==0.1.0) (2.1.1) Requirement already satisfied: idna<4,>=2.5 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from requests>=2.26.0->supervision->groundingdino==0.1.0) (3.7) Requirement already satisfied: urllib3<3,>=1.21.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from requests>=2.26.0->supervision->groundingdino==0.1.0) (2.3.0) Requirement already satisfied: certifi>=2017.4.17 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from requests>=2.26.0->supervision->groundingdino==0.1.0) (2025.4.26) Requirement already satisfied: huggingface_hub in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from timm->groundingdino==0.1.0) (0.34.4) Requirement already satisfied: safetensors in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from timm->groundingdino==0.1.0) (0.6.2) Requirement already satisfied: filelock in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from huggingface_hub->timm->groundingdino==0.1.0) (3.17.0) Requirement already satisfied: fsspec>=2023.5.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from huggingface_hub->timm->groundingdino==0.1.0) (2025.3.2) Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/hxj/.local/lib/python3.10/site-packages (from huggingface_hub->timm->groundingdino==0.1.0) (4.14.1) Requirement already satisfied: hf-xet<2.0.0,>=1.1.3 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from huggingface_hub->timm->groundingdino==0.1.0) (1.1.8) Requirement already satisfied: sympy in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (1.13.3) Requirement already satisfied: networkx in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (3.4.2) Requirement already satisfied: jinja2 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (3.1.6) Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (12.1.105) Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (12.1.105) Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (12.1.105) Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (8.9.2.26) Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (12.1.3.1) Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (11.0.2.54) Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (10.3.2.106) Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (11.4.5.107) Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (12.1.0.106) Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (2.18.1) Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (12.1.105) Requirement already satisfied: triton==2.1.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from torch->groundingdino==0.1.0) (2.1.0) Requirement already satisfied: nvidia-nvjitlink-cu12 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch->groundingdino==0.1.0) (12.9.86) Requirement already satisfied: MarkupSafe>=2.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from jinja2->torch->groundingdino==0.1.0) (3.0.2) Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from sympy->torch->groundingdino==0.1.0) (1.3.0) Requirement already satisfied: regex!=2019.12.17 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from transformers->groundingdino==0.1.0) (2024.11.6) Requirement already satisfied: tokenizers<0.22,>=0.21 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from transformers->groundingdino==0.1.0) (0.21.4) Requirement already satisfied: importlib-metadata>=6.6.0 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from yapf->groundingdino==0.1.0) (8.5.0) Requirement already satisfied: platformdirs>=3.5.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from yapf->groundingdino==0.1.0) (4.3.7) Requirement already satisfied: tomli>=2.0.1 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from yapf->groundingdino==0.1.0) (2.0.1) Requirement already satisfied: zipp>=3.20 in /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages (from importlib-metadata>=6.6.0->yapf->groundingdino==0.1.0) (3.21.0) Installing collected packages: groundingdino DEPRECATION: Legacy editable install of groundingdino==0.1.0 from file:///home/hxj/VLN-game/Grounded-Segment-Anything/GroundingDINO (setup.py develop) is deprecated. pip 25.3 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457 Running setup.py develop for groundingdino error: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> [65 lines of output] A module that was compiled using NumPy 1.x cannot be run in NumPy 2.1.3 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "/home/hxj/VLN-game/Grounded-Segment-Anything/GroundingDINO/setup.py", line 27, in <module> import torch File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/__init__.py", line 1382, in <module> from .functional import * # noqa: F403 File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/functional.py", line 7, in <module> import torch.nn.functional as F File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module> from .modules import * # noqa: F403 File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module> from .transformer import TransformerEncoder, TransformerDecoder, \ File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), Building wheel groundingdino-0.1.0 Compiling with CUDA running develop /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/setuptools/command/develop.py:42: EasyInstallDeprecationWarning: easy_install command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! easy_install.initialize_options(self) /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() running egg_info writing groundingdino.egg-info/PKG-INFO writing dependency_links to groundingdino.egg-info/dependency_links.txt writing requirements to groundingdino.egg-info/requires.txt writing top-level names to groundingdino.egg-info/top_level.txt reading manifest file 'groundingdino.egg-info/SOURCES.txt' adding license file 'LICENSE' writing manifest file 'groundingdino.egg-info/SOURCES.txt' running build_ext error: [Errno 2] No such file or directory: '/home/hxj/anaconda3/envs/vlmgame/bin/nvcc' [end of 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 ╰─> [65 lines of output] A module that was compiled using NumPy 1.x cannot be run in NumPy 2.1.3 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "/home/hxj/VLN-game/Grounded-Segment-Anything/GroundingDINO/setup.py", line 27, in <module> import torch File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/__init__.py", line 1382, in <module> from .functional import * # noqa: F403 File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/functional.py", line 7, in <module> import torch.nn.functional as F File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module> from .modules import * # noqa: F403 File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module> from .transformer import TransformerEncoder, TransformerDecoder, \ File "/home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), Building wheel groundingdino-0.1.0 Compiling with CUDA running develop /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/setuptools/command/develop.py:42: EasyInstallDeprecationWarning: easy_install command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! easy_install.initialize_options(self) /home/hxj/anaconda3/envs/vlmgame/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() running egg_info writing groundingdino.egg-info/PKG-INFO writing dependency_links to groundingdino.egg-info/dependency_links.txt writing requirements to groundingdino.egg-info/requires.txt writing top-level names to groundingdino.egg-info/top_level.txt reading manifest file 'groundingdino.egg-info/SOURCES.txt' adding license file 'LICENSE' writing manifest file 'groundingdino.egg-info/SOURCES.txt' running build_ext error: [Errno 2] No such file or directory: '/home/hxj/anaconda3/envs/vlmgame/bin/nvcc' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip.
时间: 2025-08-25 20:55:19 浏览: 6
在安装 `GroundingDINO` 包时遇到 `pip install -e GroundingDINO` 失败的问题,通常可能与 `numpy` 版本兼容性、`nvcc` 路径配置错误以及 Python 环境设置有关。以下是针对这些问题的解决方案:
### 1. 解决 `numpy` 版本兼容性问题
`GroundingDINO` 可能依赖于特定版本的 `numpy`,如果当前环境中安装的是 `numpy 2.x`,而该包仅兼容 `numpy 1.x`,则可能导致安装失败。建议将 `numpy` 回退到兼容版本,例如 `1.24.4`:
```bash
pip uninstall numpy -y
pip install numpy==1.24.4
```
这将确保与 `GroundingDINO` 的依赖兼容[^1]。
### 2. 解决 `nvcc` 路径错误问题
如果安装过程中出现与 `nvcc` 相关的错误,通常是因为系统无法找到 `CUDA Toolkit` 的路径。确保已正确安装与 PyTorch 兼容的 CUDA 工具包,并将 `nvcc` 添加到系统环境变量中。例如,对于使用 `CUDA 11.8` 的 PyTorch 版本,路径应类似如下:
```
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin
```
将此路径添加到系统 `PATH` 环境变量中,以便命令行能够识别 `nvcc` 命令。
### 3. 配置正确的 Python 环境
确保 `GroundingDINO` 安装在正确的 Python 环境中。如果系统中安装了多个 Python 版本,请使用 `virtualenv` 或 `conda` 创建隔离的虚拟环境,并确保 `pip` 使用的是与该环境对应的 Python 解释器。例如:
```bash
conda create -n groundingdino_env python=3.9
conda activate groundingdino_env
```
随后再运行安装命令:
```bash
pip install -e GroundingDINO
```
### 4. 安装依赖项并编译扩展模块
某些情况下,`GroundingDINO` 可能包含需要编译的扩展模块。确保系统已安装必要的编译工具链,例如:
- **Windows**:安装 [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
- **Linux**:安装 `build-essential` 和 `CUDA Toolkit`
此外,运行以下命令以确保所有依赖项已正确安装:
```bash
pip install torch torchvision cython
```
如果项目中包含 `setup.py`,可尝试手动运行安装步骤:
```bash
cd GroundingDINO
python setup.py build_ext --inplace
```
### 5. 处理缓存和权限问题
如果出现类似 `Another program is using this file` 的错误,可能是由于缓存文件被占用或权限不足。尝试使用 `--no-cache-dir` 选项重新安装:
```bash
pip install --no-cache-dir -e GroundingDINO
```
也可以尝试使用 `--user` 选项以用户权限安装:
```bash
pip install --user -e GroundingDINO
```
---
阅读全文
相关推荐



















