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

标签 python macos pip openai-gym

我正在遵循一个教程,要求我安装 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 的环境中,而不仅仅是安装到系统中。
  • condapip 混合使用总是存在危险,因为它们无法管理彼此的包,因此您必然会破坏您的设置最终,当您获得冲突的文件集时(不过您将能够从头开始重新创建它)。此外,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                    <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8dad7d7cbcc95c8c1ccd0d7d6f889968d81" rel="noreferrer noopener nofollow">[email protected]</a>               <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfbdb0b0acab9feef1eae8" rel="noreferrer noopener nofollow">[email protected]</a>                      <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ceee3e3fff8ccbda2babc" rel="noreferrer noopener nofollow">[email protected]</a>
boost-bcp                       boost-mpi                       boost-python3                   <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="482a27273b3c0879667d7d" rel="noreferrer noopener nofollow">[email protected]</a>                      <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e2808d8d9196a2d3ccd7db" rel="noreferrer noopener nofollow">[email protected]</a>

==> Casks
homebrew/cask/turbo-boost-switcher

关于python - 如何解决 "ERROR: Failed building wheel for doom-py",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57170181/

相关文章:

python - 无法在 OSX 中完成 mysql-python 安装

python - 如何在streamlit中显示热图颜色相关图

python - NoneType 似乎被评估为 True

node.js - 安装后直接在 macOS 上启动应用程序

mongodb - 安装后找不到命令 : mongo, (OS X)

python - 为什么pip3安装包却无法导入呢?

python - 南 : Unknown command 'migrate'

python - 从查询集中获取查询集

python - 在 Django 中连接多个表以生成单个报告

macos - 在 MacOSX 上设置 SLIME