我正在使用 docker 将我的 Flask 应用程序容器化,并且在运行时出现以下错误docker-compose build
该应用程序在我的本地计算机上运行良好。我尝试过升级 pip,使用 brew 卸载/重新安装Libxmlsec1
,pkg-config
以及使用 pip 卸载/重新安装xmlsec
。我在这里不知所措,不确定我可以采取哪些步骤来使其正常工作。任何和所有的想法表示赞赏,谢谢。
#8 74.65 Building wheel for xmlsec (PEP 517): started
#8 75.30 Building wheel for xmlsec (PEP 517): finished with status 'error'
#8 75.30 ERROR: Command errored out with exit status 1:
#8 75.30 command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpr1pesxvg
#8 75.30 cwd: /tmp/pip-install-eahoeaeb/xmlsec
#8 75.30 Complete output (22 lines):
#8 75.30 /tmp/pip-build-env-hk34bsbq/overlay/lib/python3.7/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
#8 75.30 % (opt, underscore_opt))
#8 75.30 /tmp/pip-build-env-hk34bsbq/overlay/lib/python3.7/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'build-requires' will not be supported in future versions. Please use the underscore name 'build_requires' instead
#8 75.30 % (opt, underscore_opt))
#8 75.30 /tmp/pip-build-env-hk34bsbq/overlay/lib/python3.7/site-packages/setuptools/dist.py:645: UserWarning: Usage of dash-separated 'upload-dir' will not be supported in future versions. Please use the underscore name 'upload_dir' instead
#8 75.30 % (opt, underscore_opt))
#8 75.30 running bdist_wheel
#8 75.30 running build
#8 75.30 running build_py
#8 75.30 package init file 'src/xmlsec/__init__.py' not found (or not a regular file)
#8 75.30 creating build
#8 75.30 creating build/lib.linux-x86_64-3.7
#8 75.30 creating build/lib.linux-x86_64-3.7/xmlsec
#8 75.30 copying src/xmlsec/py.typed -> build/lib.linux-x86_64-3.7/xmlsec
#8 75.30 copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-3.7/xmlsec
#8 75.30 copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-3.7/xmlsec
#8 75.30 copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-3.7/xmlsec
#8 75.30 copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-3.7/xmlsec
#8 75.30 warning: build_py: byte-compiling is disabled, skipping.
#8 75.30
#8 75.30 running build_ext
#8 75.30 error: xmlsec1 is not installed or not in path.
#8 75.30 ----------------------------------------
#8 75.30 ERROR: Failed building wheel for xmlsec
#8 75.30 Successfully built autocorrect autopep8 bs4 gunicorn MarkupSafe p5py pandocfilters simplegeneric sklearn tornado wrapt
#8 75.30 Failed to build xmlsec
#8 76.49 ERROR: Could not build wheels for xmlsec which use PEP 517 and cannot be installed directly
我正在使用以下requirements.txt
文件:
autocorrect==2.4.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
cycler==0.10.0
defusedxml==0.6.0
dnspython==2.1.0
Flask==1.1.2
gunicorn==20.1.0
idna==2.10
importlib==1.0.4
isodate==0.6.0
itsdangerous==1.1.0
Jinja2==2.11.3
joblib==1.0.1
kiwisolver==1.3.1
llvmlite==0.36.0
lxml==4.6.2
MarkupSafe==1.1.1
matplotlib==3.3.4
nltk==3.5
numba==0.53.1
numpy==1.20.1
onelogin==1.9.1
pandas==1.2.3
Pillow==8.1.2
pprintpp==0.4.0
pymongo==3.11.3
pyparsing==2.4.7
python-dateutil==2.8.1
python-dotenv==0.15.0
python3-saml==1.10.1
pytz==2021.1
regex==2020.11.13
requests==2.25.1
scikit-learn==0.24.1
scipy==1.6.1
six==1.15.0
sklearn==0.0
threadpoolctl==2.1.0
tqdm==4.59.0
urllib3==1.26.4
Werkzeug==1.0.1
xmlsec==1.3.9
编辑:我已经更新了我的 docker 文件以获取 Debian 需要用于 xmlsec 的所有包。
Dockerfile:
# Create our image based on Python 3.7.6
FROM python:3.7.6
RUN apt-get update
RUN apt-get -y install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
# Expose ports
EXPOSE 5000
# Tell Python to not generate .pyc
ENV PYTHONDONTWRITEBYTECODE 1
# Turn off buffering
ENV PYTHONUNBUFFERED 1
# Install requirements using pip
ADD requirements.txt .
RUN python -m pip install -r requirements.txt
# Set working directory and addour Flask API files
WORKDIR /app
ADD . /app