Skip to main content
 首页 » 编程设计

python之"ERROR: Failed building wheel for doom-py"如何解决

2024年09月03日38txw1958

我正在学习需要安装 ppaquette-gym-doom 的教程。但是我不断收到错误,

ERROR: Failed building wheel for doom-py 

我在 MacBook 上使用 python 3.6 中的 anaconda 环境。

我尝试安装错误代码指出我需要的软件包,

brew install boost boost-python sdl2

pip 安装 cmake

然而,这并没有帮助修复错误。我也尝试在 python 2.7 上执行此操作,但它也没有用。

这是完整的错误,

ERROR: Failed building wheel for doom-py 
... 
 
ERROR: Command errored out with exit status 1: 
     command: /Users/user/anaconda3/envs/DoomAi/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/setup.py'"'"'; __file__='"'"'/private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-record-kij0gfeh/install-record.txt --single-version-externally-managed --compile 
         cwd: /private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/ 
    Complete output (137 lines): 
    running install 
    running build 
    CMake Warning: 
      No source or binary directory provided.  Both will be assumed to be the 
      same as the current working directory, but note that this warning will 
      become a fatal error in future CMake releases. 
 
 
    -- Boost version: 1.70.0 
    -- Found the following Boost libraries: 
    --   filesystem 
    --   thread 
    --   system 
    --   date_time 
    --   chrono 
    --   regex 
    --   iostreams 
    --   atomic 
    CMake Deprecation Warning at cmake_modules/CreateLaunchers.cmake:48 (cmake_policy): 
      The OLD behavior for policy CMP0026 will be removed from a future version 
      of CMake. 
 
      The cmake-policies(7) manual explains that the OLD behaviors of all 
      policies are deprecated and that a policy should be set to OLD only under 
      specific short-term circumstances.  Projects should be ported to the NEW 
      behavior and not rely on setting a policy to OLD. 
    Call Stack (most recent call first): 
      src/vizdoom/CMakeLists.txt:13 (include) 
 
 
    -- Could NOT find GME (missing: GME_LIBRARIES GME_INCLUDE_DIR) 
    -- Using system zlib 
    -- Using system jpeg library 
    -- Using system bzip2 library 
    -- Using internal gme library 
    -- /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include 
    -- /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include 
    -- /private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/doom_py/src/vizdoom/lzma/C 
    -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
    -- Could not find FMOD include files 
    -- Could NOT find MPG123 (missing: MPG123_LIBRARIES MPG123_INCLUDE_DIR) 
    -- Could NOT find FluidSynth (missing: FLUIDSYNTH_LIBRARIES FLUIDSYNTH_INCLUDE_DIR) 
    -- Boost version: 1.70.0 
    -- Found the following Boost libraries: 
    --   thread 
    --   system 
    --   date_time 
    --   chrono 
    --   atomic 
    -- Fluid synth libs: FLUIDSYNTH_LIBRARIES-NOTFOUND 
    -- Using python library: /Users/user/anaconda3/envs/DoomAi/lib/libpython3.6m.dylib 
    -- Using python include: /Users/user/anaconda3/envs/DoomAi/include/python3.6m 
    CMake Warning at /Users/user/anaconda3/envs/DoomAi/lib/python3.6/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.14/Modules/FindBoost.cmake:1822 (message): 
      No header defined for python-py368; skipping header check 
    Call Stack (most recent call first): 
      CMakeLists.txt:124 (find_package) 
 
 
    -- Could NOT find Boost 
    CMake Warning at /Users/user/anaconda3/envs/DoomAi/lib/python3.6/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.14/Modules/FindBoost.cmake:1822 (message): 
      No header defined for python-py36; skipping header check 
    Call Stack (most recent call first): 
      CMakeLists.txt:133 (find_package) 
 
 
    -- Could NOT find Boost 
    -- Boost library python-py36: 
    -- Could NOT find Boost 
    -- Boost library python36: 
    CMake Warning at /Users/user/anaconda3/envs/DoomAi/lib/python3.6/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.14/Modules/FindBoost.cmake:1822 (message): 
      No header defined for python-py3; skipping header check 
    Call Stack (most recent call first): 
      CMakeLists.txt:133 (find_package) 
 
 
    -- Could NOT find Boost 
    -- Boost library python-py3: 
    -- Could NOT find Boost 
    -- Boost library python3: 
    CMake Error at /Users/user/anaconda3/envs/DoomAi/lib/python3.6/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.14/Modules/FindBoost.cmake:2155 (message): 
      Unable to find the requested Boost libraries. 
 
      Boost version: 1.70.0 
 
      Boost include path: /usr/local/include 
 
      Could not find the following Boost libraries: 
 
              boost_python 
 
      No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the 
      directory containing Boost libraries or BOOST_ROOT to the location of 
      Boost. 
    Call Stack (most recent call first): 
      CMakeLists.txt:151 (find_package) 
 
 
    -- Found components for NumPy 
    -- NUMPY_ROOT_DIR    = /usr/local 
    -- NUMPY_INCLUDES    = /Users/user/anaconda3/envs/DoomAi/lib/python3.6/site-packages/numpy/core/include 
    -- NUMPY_LIBRARIES   = /Users/user/anaconda3/envs/DoomAi/lib/python3.6/site-packages/numpy/core/lib/libnpymath.a 
    -- NUMPY_API_VERSION = 1.16.4 
    -- Configuring incomplete, errors occurred! 
    See also "/private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/doom_py/CMakeFiles/CMakeOutput.log". 
    See also "/private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/doom_py/CMakeFiles/CMakeError.log". 
 
    Could not build doom-py: Command '['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH=/Users/user/anaconda3/envs/DoomAi/bin/python', '-DOSX_COCOA_BACKEND=OFF']' returned non-zero exit status 1.. (HINT: are you sure cmake is installed? You might also be missing a library. doom_py requires boost, boost-python, sdl2 on OSX (installable via 'brew install boost boost-python sdl2') 
 
... 
 
ERROR: Command errored out with exit status 1: /Users/user/anaconda3/envs/DoomAi/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/setup.py'"'"'; __file__='"'"'/private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-install-hwwmtp15/doom-py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/8v/645qcxqj4lzbth2zf4x8dfcm0000gn/T/pip-record-kij0gfeh/install-record.txt --single-version-externally-managed --compile Check the logs for full command output. 

请您参考如下方法:

您可能会更幸运地为 Homebrew Python 构建它(在 virtualenv 中以便以后能够干净地删除它们)。

由于不再维护此包,代码可能已过时和/或无法使用。在满足所有依赖项后,我最终得到一个编译错误,提示 doom-py 与 Anaconda 中可用的最新版本 boost 不兼容。


在为 Anaconda 构建东西时,您需要记住两件事:

  • Anaconda 使用自己的编译器工具链和一组组件,并试图将它们与系统的其余部分隔离开来。因此,您需要专门将任何要求安装到 Anaconda 的环境中,而不仅仅是系统。
  • 将 conda 与 pip 混合使用总是有风险,因为它们无法管理彼此的包,因此您势必会破坏您的设置最终当你得到冲突的文件集时(你将能够从头开始重新创建它)。此外,Anaconda 对 Python 和其他一些包进行了补丁,因此同一包的 conda 和 pip 版本并不总是兼容。
    • 因此,conda 包应该优于 pip 包——从某种意义上说,它们不太可能以不可预测的方式破坏事物。

根据 https://github.com/ppaquette/gym-doom#dependencies ,您需要以下依赖项:

python-numpy cmake zlib1g-dev libjpeg-dev libboost-all-dev gcc libsdl2-dev wget unzip git 

由于您正在尝试在另一个环境中构建——该包不是为 AFAICS 设计的,所以所有的赌注都没有了——您需要找到这些依赖项——它们可能有不同的名称,所以您需要猜测——在 Anaconda Cloud 中并将它们安装到您的 Anaconda 环境中(如果在那里找不到某些东西,您必须从源代码构建它)。

例如(链接有安装命令):

请注意,上述某些软件包来自不同的非官方 channel ,因此它们可能彼此不完全兼容。

在 Homebrew 中,它们都存在于 homebrew-core 中:

$ for l in cmake zlib libjpeg sdl2 boost; do brew search $l; done 
==> Formulae 
cmake 
 
==> Casks 
homebrew/cask/cmake 
==> Formulae 
lzlib                                                           zlib                                                            homebrew/portable-ruby/portable-zlib 
==> Formulae 
libjpeg                                                                                         libjpeg-turbo 
==> Formulae 
sdl2                            sdl2_gfx                        sdl2_image                      sdl2_mixer                      sdl2_net                        sdl2_ttf 
==> Formulae 
boost                           boost-build                     boost-python                    boost-python@1.59               boost@1.57                      boost@1.60 
boost-bcp                       boost-mpi                       boost-python3                   boost@1.55                      boost@1.59 
 
==> Casks 
homebrew/cask/turbo-boost-switcher