`pip3 install batman-package` не работает - PullRequest
0 голосов
/ 03 августа 2020

Используя macOS 10.15.6, я установил python3 (3.8.5) через homebrew (2.4.9). Затем я установил нужные мне пакеты, используя pip3 (20.2).

Но у меня возникла проблема, когда я хочу установить модуль python под названием «batman». Сначала я установил его, используя pip3 install batman, но затем я увидел, что правильный способ - сделать pip3 install batman-package, за исключением того, что при этом я получаю длинное сообщение об ошибке, которое я пытался понять, однако мне не удалось понять, что мне нужно чтобы исправить, поэтому я спрашиваю, есть ли у кого-нибудь способ исправить это?

Спасибо

Collecting batman-package
  Using cached batman-package-2.4.6.tar.gz (29 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (from batman-package) (1.19.0)
Building wheels for collected packages: batman-package
  Building wheel for batman-package (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"'; __file__='"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-wheel-9fvrwe2s
       cwd: /private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/
  Complete output (25 lines):
  Checking for OpenMP support...
  Did not detect OpenMP support.
  /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_requires'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.8
  creating build/lib.macosx-10.15-x86_64-3.8/batman
  copying batman/openmp.py -> build/lib.macosx-10.15-x86_64-3.8/batman
  copying batman/transitmodel.py -> build/lib.macosx-10.15-x86_64-3.8/batman
  copying batman/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/batman
  copying batman/plots.py -> build/lib.macosx-10.15-x86_64-3.8/batman
  copying batman/tests.py -> build/lib.macosx-10.15-x86_64-3.8/batman
  running build_ext
  building 'batman._nonlinear_ld' extension
  creating build/temp.macosx-10.15-x86_64-3.8
  creating build/temp.macosx-10.15-x86_64-3.8/c_src
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c c_src/_nonlinear_ld.c -o build/temp.macosx-10.15-x86_64-3.8/c_src/_nonlinear_ld.o -std=c99
  c_src/_nonlinear_ld.c:21:10: fatal error: 'numpy/arrayobject.h' file not found
  #include "numpy/arrayobject.h"
           ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for batman-package
  Running setup.py clean for batman-package
Failed to build batman-package
DEPRECATION: Could not build wheels for batman-package which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: batman-package
    Running setup.py install for batman-package ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"'; __file__='"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/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/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-record-a9qct8l8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/batman-package
         cwd: /private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/
    Complete output (25 lines):
    Checking for OpenMP support...
    Did not detect OpenMP support.
    /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_requires'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-3.8
    creating build/lib.macosx-10.15-x86_64-3.8/batman
    copying batman/openmp.py -> build/lib.macosx-10.15-x86_64-3.8/batman
    copying batman/transitmodel.py -> build/lib.macosx-10.15-x86_64-3.8/batman
    copying batman/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/batman
    copying batman/plots.py -> build/lib.macosx-10.15-x86_64-3.8/batman
    copying batman/tests.py -> build/lib.macosx-10.15-x86_64-3.8/batman
    running build_ext
    building 'batman._nonlinear_ld' extension
    creating build/temp.macosx-10.15-x86_64-3.8
    creating build/temp.macosx-10.15-x86_64-3.8/c_src
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c c_src/_nonlinear_ld.c -o build/temp.macosx-10.15-x86_64-3.8/c_src/_nonlinear_ld.o -std=c99
    c_src/_nonlinear_ld.c:21:10: fatal error: 'numpy/arrayobject.h' file not found
    #include "numpy/arrayobject.h"
             ^~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/setup.py'"'"'; __file__='"'"'/private/var/folders/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-install-2xfl5s0z/batman-package/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/lm/_dqfmk_10034g3h8k09n7vsr01ncqx/T/pip-record-a9qct8l8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/batman-package Check the logs for full command output.

1 Ответ

0 голосов
/ 03 августа 2020

Хорошо, так что это была проблема с заголовками, как сказала thilina lakshan . Я перешел по ссылке, которую он разместил, и действительно, запустив export CFLAGS="-I /usr/local/lib/python3.8/site-packages/numpy/core/include $CFLAGS" в терминале, я смог установить пакет.

Большое спасибо!

...