Ошибка установки Gevent в Docker Apline Python - PullRequest
0 голосов
/ 03 июня 2019

Я пытаюсь установить Gevent на докер Python: 3.8.0a4-alpine3.9, на котором запущен gunicorn.

При сборке докера я всегда получаю сообщение об ошибке «сбой gcc со статусом выхода 1».

Я пытался установить несколько пакетов, но ни один не помог.

Вот файл Docker:

FROM python:3.8.0a4-alpine3.9

RUN echo "@edge-community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
  apk update && \
  apk add build-base python-dev && \
  apk add py-gevent

RUN pip install gunicorn gevent

Команда: docker build . -t "test:one"

Последние несколько строк вывода:


  /usr/local/include/python3.8/code.h:105:28: note: expected 'PyObject *' {aka 'struct _object *'} but argument is of type 'int'
   PyAPI_FUNC(PyCodeObject *) PyCode_New(
                              ^~~~~~~~~~
  src/gevent/libev/corecext.c:21340:9: warning: passing argument 15 of 'PyCode_New' makes integer from pointer without a cast [-Wint-conversion]
           __pyx_empty_bytes  /*PyObject *lnotab*/
           ^~~~~~~~~~~~~~~~~
  src/gevent/libev/corecext.c:373:79: note: in definition of macro '__Pyx_PyCode_New'
             PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
                                                                                 ^~~~
  In file included from /usr/local/include/python3.8/compile.h:5,
                   from /usr/local/include/python3.8/Python.h:137,
                   from src/gevent/libev/corecext.c:63:
  /usr/local/include/python3.8/code.h:105:28: note: expected 'int' but argument is of type 'PyObject *' {aka 'struct _object *'}
   PyAPI_FUNC(PyCodeObject *) PyCode_New(
                              ^~~~~~~~~~
  src/gevent/libev/corecext.c:373:11: error: too few arguments to function 'PyCode_New'
             PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
             ^~~~~~~~~~
  src/gevent/libev/corecext.c:21325:15: note: in expansion of macro '__Pyx_PyCode_New'
       py_code = __Pyx_PyCode_New(
                 ^~~~~~~~~~~~~~~~
  In file included from /usr/local/include/python3.8/compile.h:5,
                   from /usr/local/include/python3.8/Python.h:137,
                   from src/gevent/libev/corecext.c:63:
  /usr/local/include/python3.8/code.h:105:28: note: declared here
   PyAPI_FUNC(PyCodeObject *) PyCode_New(
                              ^~~~~~~~~~
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for gevent
  Running setup.py clean for gevent

...
lots of stuff
...


out a cast [-Wint-conversion]
             __pyx_empty_bytes  /*PyObject *lnotab*/
             ^~~~~~~~~~~~~~~~~
    src/gevent/libev/corecext.c:373:79: note: in definition of macro '__Pyx_PyCode_New'
               PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
                                                                                   ^~~~
    In file included from /usr/local/include/python3.8/compile.h:5,
                     from /usr/local/include/python3.8/Python.h:137,
                     from src/gevent/libev/corecext.c:63:
    /usr/local/include/python3.8/code.h:105:28: note: expected 'int' but argument is of type 'PyObject *' {aka 'struct _object *'}
     PyAPI_FUNC(PyCodeObject *) PyCode_New(
                                ^~~~~~~~~~
    src/gevent/libev/corecext.c:373:11: error: too few arguments to function 'PyCode_New'
               PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
               ^~~~~~~~~~
    src/gevent/libev/corecext.c:21325:15: note: in expansion of macro '__Pyx_PyCode_New'
         py_code = __Pyx_PyCode_New(
                   ^~~~~~~~~~~~~~~~
    In file included from /usr/local/include/python3.8/compile.h:5,
                     from /usr/local/include/python3.8/Python.h:137,
                     from src/gevent/libev/corecext.c:63:
    /usr/local/include/python3.8/code.h:105:28: note: declared here
     PyAPI_FUNC(PyCodeObject *) PyCode_New(
                                ^~~~~~~~~~
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-3i9v17bs/gevent/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-gnyfyggo/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-3i9v17bs/gevent/

Вот команда Gunicorn, которую я выполняю:

gunicorn web.wsgi:application --bind 0.0.0.0:8000  --worker-connections 1000 --workers 6 -k gevent

У вас есть идеи, как установить Gevent с этой версией Python Alpine?

Редактировать - Он успешно установлен на последней версии Apline и python - ОТ python: 3.7-alpine3.8

1 Ответ

0 голосов
/ 04 июня 2019

См. это , несколько лет назад, ребята хотят установить на python3.7 и столкнулись с проблемой, и в прошлом году было сделано исправление для поддержки gevent python3.7.

Итак, я полагаю, что команде gevent нужны дополнительные усилия для адаптации к каждой версии Python, поскольку ее принцип заключается в том, чтобы сделать несколько monkey patch для Python.

И, исходя из своего текущего официального объявления , говорится:

gevent 1.5 работает на Python 2.7.9 и выше, и Python 3.5, 3.6 и 3.7.

В нем не упоминалось 3.8, поэтому определенно нужно подождать,

...