无法在 Docker 中为 arm64 安装或构建 statsmodels

时间:2021-06-27 12:27:46

标签: python docker numpy statsmodels arm64

我正在尝试在 python:3.7.10-slim-buster 上构建一个 Docker 镜像,并满足以下要求:

['?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☺',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '♥',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '♥',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☺',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '♥',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☀',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '♥',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '☕',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '⚡',
 '?',
 '?',
 '?',
 '☺',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☺',
 '?',
 '♥',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '®',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☀',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☺',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '♥',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '⚡',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☺',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✨',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☕',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '☕',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☔',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☺',
 '???????',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '☀',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '☔',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '???',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '??❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '❤',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✊',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '?',
 '✌',
 '?',
 ...]

Dockerfile 是:

click==7.1.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
flask==1.1.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
gunicorn==20.1.0; python_version >= "3.5"
itsdangerous==1.1.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
jinja2==2.11.3; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
joblib==1.0.1; python_version >= "3.6"
markupsafe==1.1.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
numpy==1.20.2; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "3.10"
pandas==1.1.5; python_full_version >= "3.6.1"
patsy==0.5.1; python_version >= "3.6"
python-dateutil==2.8.1; python_full_version >= "3.6.1" and python_version >= "3.6"
pytz==2021.1; python_full_version >= "3.6.1" and python_version >= "3.6"
scipy==1.7.0; python_version >= "3.7" and python_version < "3.10"
six==1.16.0; python_full_version >= "3.6.1" and python_version >= "3.6"
statsmodels==0.12.2; python_version >= "3.6"
toml==0.10.2; (python_version >= "2.6" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
werkzeug==1.0.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"

我正在为基于 ARM64 的主板构建映像并使用以下命令:

FROM python:3.7.10-slim-buster
LABEL maintainer="<redacted>"

RUN useradd -m <username> -s /bin/bash
WORKDIR /home/<username>

RUN apt-get update -yq && apt-get upgrade -yq && \
    apt-get install -yq build-essential make gcc g++ && \
    apt-get install -yq python3-dev build-essential && \
    apt-get install -yq curl libpq-dev libffi-dev apt-utils && \
    apt-get install -y git &&\
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

ENV PIP_DISABLE_PIP_VERSION_CHECK=1

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt --compile --no-cache-dir

RUN cd /home/<username>

COPY --chown=<username>:<username> app app
COPY manage.py config.py ./

USER <username>

EXPOSE 8081
ENTRYPOINT ["gunicorn", "--timeout", "300", "-b", "0.0.0.0:8081", "manage:app"]

$ docker buildx build --platform linux/arm64 -f Dockerfile.base \ -t box-api.base:$LOGNAME . pandasnumpy 都可以从轮子上完美安装。但是,当它尝试安装 scipy 时,它总是强制重新构建 numpy,从而导致以下错误:

statsmodels

在 arm64 上启动和运行 #11 304.3 creating build/temp.linux-aarch64-3.7/build/src.linux-aarch64-3.7/numpy/core/src/npysort #11 304.3 compile options: '-Ibuild/src.linux-aarch64-3.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.linux-aarch64-3.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/include/python3.7m -Ibuild/src.linux-aarch64-3.7/numpy/core/src/private -Ibuild/src.linux-aarch64-3.7/numpy/core/src/npymath -Ibuild/src.linux-aarch64-3.7/numpy/core/src/private -Ibuild/src.linux-aarch64-3.7/numpy/core/src/npymath -Ibuild/src.linux-aarch64-3.7/numpy/core/src/private -Ibuild/src.linux-aarch64-3.7/numpy/core/src/npymath -c' #11 304.3 gcc: build/src.linux-aarch64-3.7/numpy/core/src/npysort/heapsort.cgcc: build/src.linux-aarch64-3.7/numpy/core/src/npysort/quicksort.cgcc: build/src.linux-aarch64-3.7/numpy/core/src/npysort/mergesort.c #11 304.3 #11 304.3 gcc: build/src.linux-aarch64-3.7/numpy/core/src/npysort/selection.c #11 304.3 #11 304.3 gcc: build/src.linux-aarch64-3.7/numpy/core/src/npysort/binsearch.c #11 304.3 ar: adding 5 object files to build/temp.linux-aarch64-3.7/libnpysort.a #11 304.3 qemu: uncaught target signal 11 (Segmentation fault) - core dumped #11 304.3 ---------------------------------------- #11 304.3 ERROR: Command errored out with exit status -11: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o4a9t3f7/numpy_df0eb5a6ab8e418abed6687e2c185c92/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o4a9t3f7/numpy_df0eb5a6ab8e418abed6687e2c185c92/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-853_r9zp/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-v7h49vpx/overlay --compile --install-headers /tmp/pip-build-env-v7h49vpx/overlay/include/python3.7m/numpy Check the logs for full command output. #11 304.3 ---------------------------------------- #11 304.3 WARNING: Discarding https://files.pythonhosted.org/packages/10/26/0fd61f95667e56fd597ecca715dff3623ed1122b6f895ed2b4dfb54afc04/statsmodels-0.12.2.tar.gz#sha256=8ad7a7ae7cdd929095684118e3b05836c0ccb08b6a01fe984159475d174a1b10 (from https://pypi.org/simple/statsmodels/) (requires-python:>=3.6). Command errored out with exit status 1: /usr/local/bin/python /tmp/pip-standalone-pip-z5vtpw8_/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-v7h49vpx/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'cython>=0.29.14' 'numpy==1.15.4; python_version=='"'"'3.6'"'"'' 'numpy==1.15.4; python_version=='"'"'3.7'"'"'' 'numpy==1.17.5; python_version>='"'"'3.8'"'"'' 'scipy>=1.2' Check the logs for full command output. #11 304.3 ERROR: Could not find a version that satisfies the requirement statsmodels==0.12.2 (from versions: 0.4.0, 0.4.1, 0.4.3, 0.5.0rc1, 0.5.0, 0.6.0rc1, 0.6.0rc2, 0.6.0, 0.6.1, 0.8.0rc1, 0.8.0, 0.9.0rc1, 0.9.0, 0.10.0rc2, 0.10.0, 0.10.1, 0.10.2, 0.11.0rc1, 0.11.0rc2, 0.11.0, 0.11.1, 0.12.0rc0, 0.12.0, 0.12.1, 0.12.2) #11 304.3 ERROR: No matching distribution found for statsmodels==0.12.2 ------ error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c pip install -r requirements.txt --compile --no-cache-dir]: exit code: 1 的最简单方法是什么?

0 个答案:

没有答案