扭曲 iocp 支持的构建轮子失败

问题描述 投票:0回答:1

我正在尝试对我的 django 项目进行 docker 化。当我运行“docker build -t django_project”时,出现以下错误:

18.82   Building wheel for twisted-iocpsupport (pyproject.toml): started
19.23   Building wheel for twisted-iocpsupport (pyproject.toml): finished with status 'error'
19.24   error: subprocess-exited-with-error
19.24
19.24   × Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully.
19.24   │ exit code: 1
19.24   ╰─> [13 lines of output]
19.24       running bdist_wheel
19.24       running build
19.24       running build_ext
19.24       building 'twisted_iocpsupport.iocpsupport' extension
19.24       creating build
19.24       creating build/temp.linux-x86_64-cpython-39
19.24       creating build/temp.linux-x86_64-cpython-39/twisted_iocpsupport
19.24       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Itwisted_iocpsupport -I/usr/local/include/python3.9 -c twisted_iocpsupport/iocpsupport.c -o build/temp.linux-x86_64-cpython-39/twisted_iocpsupport/iocpsupport.o
19.24       twisted_iocpsupport/iocpsupport.c:1210:10: fatal error: io.h: No such file or directory
19.24        1210 | #include "io.h"
19.24             |          ^~~~~~
19.24       compilation terminated.
19.24       error: command '/usr/bin/gcc' failed with exit code 1
19.24       [end of output]
19.24
19.24   note: This error originates from a subprocess, and is likely not a problem with pip.
19.24   ERROR: Failed building wheel for twisted-iocpsupport
19.24 Successfully built autobahn
19.24 Failed to build twisted-iocpsupport
19.24 ERROR: Could not build wheels for twisted-iocpsupport, which is required to install pyproject.toml-based projects
19.70
19.70 [notice] A new release of pip is available: 23.0.1 -> 23.3.1
19.70 [notice] To update, run: pip install --upgrade pip
------
Dockerfile:13
--------------------
  11 |     # Copy the requirements file into the container and install the Python dependencies
  12 |     COPY requirements.txt /app/
  13 | >>> RUN pip install --no-cache-dir -r requirements.txt --no-dependencies
  14 |
  15 |     # Copy the entire project directory into the container
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install --no-cache-dir -r requirements.txt --no-dependencies" did not complete successfully: exit code: 1

我的要求.txt:

asgiref==3.7.2
attrs==23.1.0
autobahn==23.6.2
Automat==22.10.0
cffi==1.16.0
channels==4.0.0
constantly==23.10.4
cryptography==41.0.5
daphne==4.0.0 
Django==4.2.7
hyperlink==21.0.0
idna==3.4
incremental==22.10.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
pyOpenSSL==23.3.0
python-decouple==3.8
service-identity==23.1.0
six==1.16.0
sqlparse==0.4.4
Twisted==23.10.0
twisted-iocpsupport==1.0.4
txaio==23.1.1
typing_extensions==4.8.0
tzdata==2023.3
zope.interface==6.1

Dockerfile:

FROM python:3.9.18

ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE django_project.settings  

WORKDIR /app

COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

COPY . /app/

EXPOSE 8000

CMD ["gunicorn", "django_project.wsgi:application", "--bind", "0.0.0.0:8000"]  

Python 版本 3.9.18。

问题是daphne 正在尝试安装twisted-iocpsupport 依赖项。如何修复它并 dockerize django 项目?

更新: 添加了 Dockerfile

python django docker twisted daphne
1个回答
0
投票

此问题通常是由于依赖项的版本重叠而发生的。您可能想放宽依赖版本并让 pip 选择它。您可以尝试从requirements.txt中删除该库的版本

改变 扭曲的iocpsupport==1.0.4 到 扭曲 iocp 支持

© www.soinside.com 2019 - 2024. All rights reserved.