由于 python greenlet 包,Docker 构建崩溃

如何解决由于 python greenlet 包,Docker 构建崩溃

我正在尝试从现有的 Dockerfile 创建一个 Docker 容器,但由于 greenlet 包而失败。这个容器是以前(1-2 年前)构建的,并且在远程服务器上运行良好,但是当我尝试在本地或其他云机器上再次构建时,它失败了。非常感谢任何帮助。

这是 Dockerfile

FROM python:2.7-alpine

RUN apk update && apk add \
        postgresql-dev \
        python3-dev \
        gcc \
        jpeg-dev \
        zlib-dev \
        musl-dev \
        linux-headers && \
        mkdir app

workdir /app/

# Ensure that Python outputs everything that's printed inside
# the application rather than buffering it.
ENV PYTHONUNBUFFERED 1

ADD . /app

RUN if [ -s requirements.txt ]; then pip install -r requirements.txt; fi
EXPOSE 8092
VOLUME /app/auction/assets
ENTRYPOINT ["/usr/local/bin/uwsgi","--ini","/app/uwsgi.ini"]

这是我得到的错误

#10 64.38 Successfully built logutils psycopg2 Pillow django-endless-pagination django-templated-email xlrd plivo uWsgi billiard anyjson
#10 64.38 Failed to build greenlet
#10 64.60 Installing collected packages: Django,urllib3,idna,chardet,certifi,requests,greenlet,pygments,six,typing,backports.functools-lru-cache,wcwidth,blessings,curtsies,bpython,django-braces,django-model-utils,logutils,psycopg2,Pillow,django-multiupload,django-endless-pagination,python-dateutil,django-templated-email,billiard,pytz,amqp,anyjson,kombu,redis,celery,sorl-thumbnail,xlrd,plivo,uWsgi
#10 68.78     Running setup.py install for greenlet: started
#10 69.83     Running setup.py install for greenlet: finished with status 'error'
#10 69.83     ERROR: Command errored out with exit status 1:
#10 69.83      command: /usr/local/bin/python -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-GNyJHs/greenlet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-GNyJHs/greenlet/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-VFmzYm/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python2.7/greenlet
#10 69.83          cwd: /tmp/pip-install-GNyJHs/greenlet/
#10 69.83     Complete output (82 lines):
#10 69.83     running install
#10 69.83     running build
#10 69.83     running build_py
#10 69.83     creating build
#10 69.83     creating build/lib.linux-x86_64-2.7
#10 69.83     creating build/lib.linux-x86_64-2.7/greenlet
#10 69.83     copying src/greenlet/__init__.py -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83     creating build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_cpp.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/__init__.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_gc.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_greenlet.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_tracing.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_generator.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_contextvars.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_extension_interface.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_version.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_generator_nested.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_leaks.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_weakref.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_throw.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/test_stack_saved.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     running egg_info
#10 69.83     writing requirements to src/greenlet.egg-info/requires.txt
#10 69.83     writing src/greenlet.egg-info/PKG-INFO
#10 69.83     writing top-level names to src/greenlet.egg-info/top_level.txt
#10 69.83     writing dependency_links to src/greenlet.egg-info/dependency_links.txt
#10 69.83     reading manifest file 'src/greenlet.egg-info/SOURCES.txt'
#10 69.83     reading manifest template 'MANIFEST.in'
#10 69.83     no prevIoUsly-included directories found matching 'docs/_build'
#10 69.83     warning: no files found matching '*.py' under directory 'appveyor'
#10 69.83     warning: no prevIoUsly-included files matching '*.pyc' found anywhere in distribution
#10 69.83     warning: no prevIoUsly-included files matching '*.pyd' found anywhere in distribution
#10 69.83     warning: no prevIoUsly-included files matching '*.so' found anywhere in distribution
#10 69.83     warning: no prevIoUsly-included files matching '.coverage' found anywhere in distribution
#10 69.83     writing manifest file 'src/greenlet.egg-info/SOURCES.txt'
#10 69.83     copying src/greenlet/greenlet.c -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83     copying src/greenlet/greenlet.h -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83     copying src/greenlet/slp_platformselect.h -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83     creating build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/setup_switch_x64_masm.cmd -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_aarch64_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_alpha_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_amd64_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_arm32_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_arm32_ios.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_csky_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_m68k_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_mips_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_ppc64_aix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_ppc64_linux.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_ppc_aix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_ppc_linux.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_ppc_macosx.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_ppc_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_riscv_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_s390_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_sparc_sun_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_x32_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_x64_masm.asm -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_x64_masm.obj -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_x64_msvc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_x86_msvc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/platform/switch_x86_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83     copying src/greenlet/tests/_test_extension.c -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     copying src/greenlet/tests/_test_extension_cpp.cpp -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83     running build_ext
#10 69.83     building 'greenlet._greenlet' extension
#10 69.83     creating build/temp.linux-x86_64-2.7
#10 69.83     creating build/temp.linux-x86_64-2.7/src
#10 69.83     creating build/temp.linux-x86_64-2.7/src/greenlet
#10 69.83     gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python2.7 -c src/greenlet/greenlet.c -o build/temp.linux-x86_64-2.7/src/greenlet/greenlet.o
#10 69.83     gcc -shared build/temp.linux-x86_64-2.7/src/greenlet/greenlet.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/greenlet/_greenlet.so
#10 69.83     building 'greenlet.tests._test_extension' extension
#10 69.83     creating build/temp.linux-x86_64-2.7/src/greenlet/tests
#10 69.83     gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python2.7 -c src/greenlet/tests/_test_extension.c -o build/temp.linux-x86_64-2.7/src/greenlet/tests/_test_extension.o
#10 69.83     gcc -shared build/temp.linux-x86_64-2.7/src/greenlet/tests/_test_extension.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/greenlet/tests/_test_extension.so
#10 69.83     building 'greenlet.tests._test_extension_cpp' extension
#10 69.83     gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python2.7 -c src/greenlet/tests/_test_extension_cpp.cpp -o build/temp.linux-x86_64-2.7/src/greenlet/tests/_test_extension_cpp.o
#10 69.83     gcc: Fatal error: cannot execute 'cc1plus': execvp: No such file or directory
#10 69.83     compilation terminated.
#10 69.83     error: command 'gcc' Failed with exit status 1
#10 69.83     ----------------------------------------
#10 70.42 ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys,'"'"'exec'"'"'))' install --record /tmp/pip-record-VFmzYm/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python2.7/greenlet Check the logs for full command output.
#10 70.90 WARNING: You are using pip version 20.0.2; however,version 20.3.4 is available.
#10 70.90 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor Failed running [/bin/sh -c if [ -s requirements.txt ]; then pip install -r requirements.txt; fi]: exit code: 1

解决方法

我遇到了同样的问题,但使用基本 Python 映像 python:3.7.4-alpine3.10。最近发布的 SQLAlchemy 版本似乎是问题的根源。

为了解决这个问题,我只是从需求文件中删除了包并构建了一个空容器。我单独运行了安装,发现 SQLAlchemy 及其依赖项需要固定到以前的版本。

我的需求文件失败了:

Flask==1.1.2
Flask-Ext==0.1
Flask-Script
flask-cors
flask-login
Flask-Migrate
mysql-connector-python
python-dotenv
sqlalchemy
pytest-flask

已安装的更新版本:

Flask==1.1.2
Flask-Ext==0.1
Flask-Script
flask-cors
flask-login
Flask-SQLAlchemy==2.4.4
Flask-Migrate==2.6.0
mysql-connector-python
python-dotenv
sqlalchemy==1.3.23
pytest-flask

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?