运行 build_ext 在构建 detectorron2 时给出“[WinError 2] 系统找不到指定的文件”

问题描述 投票:0回答:1

我目前正在尝试在 Anaconda 环境中构建 detectorron2。以下是我在环境中使用的软件包:

  • Windows 11
  • 康达包
  • python 3.8
  • cuda 11.3
  • pytorch 1.11
  • 火炬音频0.11.0
  • 火炬视觉0.12.0
  • 忍者1.10.2
  • pybind11 2.10.4

我已将 git 克隆到我自己的目录,因此我使用此命令安装 detectorron2

python -m pip install -e detectron2
(Detectron2 是克隆的 git 的文件夹名称) 但是,我在使用 setup.py 构建 detectorron2 时收到此错误

running develop
    running egg_info
    writing detectron2.egg-info\PKG-INFO
    writing dependency_links to detectron2.egg-info\dependency_links.txt
    writing requirements to detectron2.egg-info\requires.txt
    writing top-level names to detectron2.egg-info\top_level.txt
    reading manifest file 'detectron2.egg-info\SOURCES.txt'
    adding license file 'LICENSE'
    writing manifest file 'detectron2.egg-info\SOURCES.txt'
    running build_ext
    c:\conda\detect\lib\site-packages\setuptools\command\develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer, pypa/build or
            other standards-based tools.

            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************

    !!
      easy_install.initialize_options(self)
    c:\conda\detect\lib\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, pypa/build or
            other standards-based tools.

            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************

    !!
      self.initialize_options()
    error: [WinError 2] The system cannot find the file specified

我尝试过其他方法,例如运行:

python -m pip install .
在克隆的 git 路径中时,但我不断收到相同的错误,即运行 build_ext 时系统找不到指定的文件。 跑步
python setup.py build develop
也给了我同样的错误,它说:

running build
running build_py
running build_ext
error: [WinError 2] The system cannot find the file specified

我意识到这可能是 setuptools 包的问题。我尝试更新软件包,将 python 降级到 3.7,将 pytorch 降级到 1.10,并将 C++ 编译器添加到我的设备路径,但问题仍然存在。 我和我的导师目前已经没有想法了。也许有人知道如何解决这个问题?我将不胜感激您的回复。谢谢你。

pytorch setuptools detectron
1个回答
0
投票

所以我也遇到了同样的问题。我已经从 conda 安装了 torch 及其相应的 cuda,但没有从 Nvidia 安装任何本地 cuda。

我通过确保从 Nvidia 网站手动安装了正确的 cudatoolkit 并将 CUDA_PATH 和 CUDA_HOME 环境变量指向其目录来解决这个问题。使用 conda 安装的 cuda 运行时和 cudatoolkit 显然是裸机,在安装 cuda 相关包(例如 detectorron2 和 mmcv)时不能满足要求。我希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.