简体   繁体   English

gevent 21.12.0 在 mac os monterey 中安装失败

[英]gevent 21.12.0 installation failing in mac os monterey

I am trying to install gevent 21.12.0 on Mac OS Monterey (version 12.6) with python 3.9.6 and pip 21.3.1.我正在尝试使用 python 3.9.6 和 pip 21.3.1 在 Mac OS Monterey(版本 12.6)上安装 gevent 21.12.0。 But it is failing with the below error.但它因以下错误而失败。 Any suggestion?有什么建议吗?

(venv) debrajmanna@debrajmanna-DX6QR261G3 qa % pip install gevent
Collecting gevent
  Using cached gevent-21.12.0.tar.gz (6.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting greenlet<2.0,>=1.1.0
  Using cached greenlet-1.1.3-cp39-cp39-macosx_10_9_universal2.whl
Collecting zope.event
  Using cached zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Collecting zope.interface
  Using cached zope.interface-5.4.0-cp39-cp39-macosx_10_9_universal2.whl
Requirement already satisfied: setuptools in /Users/debrajmanna/code/python/github/spotnana/venv/lib/python3.9/site-packages (from gevent) (60.2.0)
Building wheels for collected packages: gevent
  Building wheel for gevent (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/debrajmanna/code/python/github/spotnana/venv/bin/python /Users/debrajmanna/code/python/github/spotnana/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/tmpi2i_lqc2
       cwd: /private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370
  Complete output (46 lines):
  running bdist_wheel
  running build
  running build_py
  running build_ext
  generating cffi module 'build/temp.macosx-10.9-universal2-cpython-39/gevent.libuv._corecffi.c'
  Running '(cd  "/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/libev"  && sh ./configure -C > configure-output.txt )' in /private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370
  generating cffi module 'build/temp.macosx-10.9-universal2-cpython-39/gevent.libev._corecffi.c'
  Not configuring libev, 'config.h' already exists
  Not configuring libev, 'config.h' already exists
  building 'gevent.libev.corecext' extension
  Embedding c-ares <cffi.setuptools_ext._add_c_module.<locals>.build_ext_make_mod object at 0x104f40bb0> <_setuputils.Extension('gevent.resolver.cares') at 0x1048f4640>
  Inserted  build/temp.macosx-10.9-universal2-cpython-39/c-ares/include in include dirs ['build/temp.macosx-10.9-universal2-cpython-39/c-ares/include', '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9', '/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps', '/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/c-ares/include', '/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/c-ares/src/lib', 'src/gevent', 'src/gevent/libev', 'src/gevent/resolver', '.']
  Running '(cd  "/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/c-ares"  && if [ -r include/ares_build.h ]; then cp include/ares_build.h include/ares_build.h.orig; fi   && sh ./configure --disable-dependency-tracking -C CFLAGS="-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration"  && cp src/lib/ares_config.h include/ares_build.h "$OLDPWD"   && cat include/ares_build.h   && if [ -r include/ares_build.h.orig ]; then mv include/ares_build.h.orig include/ares_build.h; fi) > configure-output.txt' in /private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/build/temp.macosx-10.9-universal2-cpython-39/c-ares/include
  configure: WARNING: Continuing even with errors mentioned immediately above this line.
  rm: conftest.dSYM: is a directory
  rm: conftest.dSYM: is a directory
  configure: WARNING: Continuing even with errors mentioned immediately above this line.
  building 'gevent.resolver.cares' extension
  building 'gevent._gevent_c_greenlet_primitives' extension
  building 'gevent._gevent_c_hub_primitives' extension
  building 'gevent._gevent_c_hub_local' extension
  building 'gevent._gevent_c_waiter' extension
  building 'gevent._gevent_cgreenlet' extension
  building 'gevent._gevent_c_tracer' extension
  building 'gevent._gevent_c_abstract_linkable' extension
  building 'gevent._gevent_c_semaphore' extension
  building 'gevent._gevent_clocal' extension
  building 'gevent._gevent_c_ident' extension
  building 'gevent._gevent_c_imap' extension
  building 'gevent._gevent_cevent' extension
  building 'gevent._gevent_cqueue' extension
  src/gevent/queue.c:7071:12: warning: unused function '__pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__' [-Wunused-function]
  static int __pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__(PyObject *__pyx_v_self) {
             ^
  1 warning generated.
  src/gevent/queue.c:7071:12: warning: unused function '__pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__' [-Wunused-function]
  static int __pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__(PyObject *__pyx_v_self) {
             ^
  1 warning generated.
  building 'gevent.libev._corecffi' extension
  building 'gevent.libuv._corecffi' extension
  build/temp.macosx-10.9-universal2-cpython-39/gevent.libuv._corecffi.c:50:14: fatal error: 'pyconfig.h' file not found
  #    include <pyconfig.h>
               ^~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for gevent
Failed to build gevent
ERROR: Could not build wheels for gevent, which is required to install pyproject.toml-based projects

Looked all over trying to figure out a solution to this problem until I finally stumbled on this post .到处寻找解决这个问题的方法,直到我最终偶然发现了这篇文章

I think the issue is specific to the virtual environment.我认为这个问题特定于虚拟环境。 I had the project open with it's own venv in PyCharm, and it seems that the python distribution headers were not findable.我在 PyCharm 中用它自己的 venv 打开了项目,似乎找不到 python 分发标头。

To reiterate the solution linked:重申解决方案链接:

  1. Find where the Python.h file is defined.找到 Python.h 文件的定义位置。 I was able to find it using find /usr/local -name Python.h我能够使用find /usr/local -name Python.h找到它
  2. Copy the path to the directory Python.h is defined in复制路径到目录Python.h定义在
  3. Set the C_INCLUDE_PATH environment variable accordingly, for me: export C_INCLUDE_PATH="/usr/local/munki/Python.framework/Versions/3.9/include/python3.9"相应地设置C_INCLUDE_PATH环境变量,对我来说: export C_INCLUDE_PATH="/usr/local/munki/Python.framework/Versions/3.9/include/python3.9"

After this, I was able to run pip3 install gevent with no issues.在此之后,我能够毫无问题地运行pip3 install gevent

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM