我正在尝试在基于 python37-alpine 的 docker 映像中安装 pendulum 2.0.5,但它给了我以下错误:
Installing dependencies from Pipfile.lock (0157fa)…
An error occurred while installing pendulum==2.0.5 --hash=sha256:1cde6e3c6310fb882c98f373795f807cb2bd6af01f34d2857e6e283b5ee91e09 --hash=sha256:485aef2089defee88607d37d5bc238934d0b90993d7bf9ceb36e481af41e9c66 --hash=sha256:57801754e05f30e8a7e4d24734c9fad82c6c3ec489151555f0fc66bb32ba6d6d --hash=sha256:7ee344bc87cb425b04717b90d14ffde14c1dd64eaa73060b3772edcf57f3e866 --hash=sha256:c460f4d8dc41ec3c4377ac1807678cd72fe5e973cc2943c104ffdeaac32dacb7 --hash=sha256:d3078e007315a959989c41cee5cfd63cfeeca21dd3d8295f4bc24199489e9b6c! Will try again.
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1874, in do_install
[pipenv.exceptions.InstallError]: keep_outdated=keep_outdated
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting pendulum==2.0.5', ' Using cached https://files.pythonhosted.org/packages/e0/f9/ea90c2c8f0d9b6a733f6231fac6d07476b68271bcf02bab0053888ea0fb3/pendulum-2.0.5.tar.gz', ' Installing build dependencies: started', " Installing build dependencies: finished with status 'error'"]
[pipenv.exceptions.InstallError]: ['ERROR: Command errored out with exit status 1:', " command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-36izf7_5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'poetry>=0.12'", ' cwd: None', ' Complete output (177 lines):', ' Collecting poetry>=0.12', ' Using cached https://files.pythonhosted.org/packages/d9/ca/6db99ba6be273b13ba3747ccfcc357714dd60c887d1f2598119ee1909262/poetry-1.0.0-py2.py3-none-any.whl', ' Collecting html5lib<2.0,>=1.0', ' Using cached https://files.pythonhosted.org/packages/a5/62/bbd2be0e7943ec8504b517e62bab011b4946e1258842bc159e5dfde15b96/html5lib-1.0.1-py2.py3-none-any.whl', ' Collecting pyparsing<3.0,>=2.2', ' Using cached https://files.pythonhosted.org/packages/c0/0c/fc2e007d9a992d997f04a80125b0f183da7fb554f1de701bbb70a8e7d479/pyparsing-2.4.5-py2.py3-none-any.whl', ' Collecting cachecontrol[filecache]<0.13.0,>=0.12.4', ' Using cached https://files.pythonhosted.org/packages/5e/f0/2c193ed1f17c97ae539da7e1c2d48b80d8cccb1917163b26a91ca4355aa6/CacheControl-0.12.5.tar.gz', ' Collecting requests-toolbelt<0.9.0,>=0.8.0', ' Using cached https://files.pythonhosted.org/packages/97/8a/d710f792d6f6ecc089c5e55b66e66c3f2f35516a1ede5a8f54c13350ffb0/requests_toolbelt-0.8.0-py2.py3-none-any.whl', ' Collecting pexpect<5.0.0,>=4.7.0', ' Using cached https://files.pythonhosted.org/packages/0e/3e/377007e3f36ec42f1b84ec322ee12141a9e10d808312e5738f52f80a232c/pexpect-4.7.0-py2.py3-none-any.whl', ' Collecting pyrsistent<0.15.0,>=0.14.2', ' Using cached https://files.pythonhosted.org/packages/8c/46/4e93ab8a379d7efe93f20a0fb8a27bdfe88942cc954ab0210c3164e783e0/pyrsistent-0.14.11.tar.gz', ' Collecting keyring<20.0,>=19.0; python_version >= "3.5" and python_version < "4.0"', ' Using cached https://files.pythonhosted.org/packages/70/33/8a7aa9da0cbdd26cd13ccfdab34da47bf561e9587d6cbf02f9d48d717047/keyring-19.3.0-py2.py3-none-any.whl', ' Collecting tomlkit<0.6.0,>=0.5.8', ' Using cached https://files.pythonhosted.org/packages/3e/30/7c2693fc50bd466285ec22bf02ee344be1bde3e2e8267e302fdc82d11f2d/tomlkit-0.5.8-py2.py3-none-any.whl', ' Collecting pkginfo<2.0,>=1.4', ' Using cached https://files.pythonhosted.org/packages/e6/d5/451b913307b478c49eb29084916639dc53a88489b993530fed0a66bab8b9/pkginfo-1.5.0.1-py2.py3-none-any.whl', ' Collecting importlib-metadata<0.24,>=0.23; python_version < "3.8"', ' Using cached https://files.pythonhosted.org/packages/f6/d2/40b3fa882147719744e6aa50ac39cf7a22a913cbcba86a0371176c425a3b/importlib_metadata-0.23-py2.py3-none-any.whl', ' Collecting jsonschema<4.0,>=3.1', ' Using cached https://files.pythonhosted.org/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl', ' Collecting cleo<0.8.0,>=0.7.6', ' Using cached https://files.pythonhosted.org/packages/4b/9d/10a5923c14c4f0faa98216af5262938f468af76101d9cd124ad2054943c7/cleo-0.7.6-py2.py3-none-any.whl', ' Collecting requests<3.0,>=2.18', ' Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl', ' Collecting cachy<0.4.0,>=0.3.0', ' Using cached https://files.pythonhosted.org/packages/82/e6/badd9af6feee43e76c3445b2621a60d3d99fe0e33fffa8df43590212ea63/cachy-0.3.0-py2.py3-none-any.whl', ' Collecting clikit<0.5.0,>=0.4.1', ' Using cached https://files.pythonhosted.org/packages/2c/08/b826f8336109e6d3e27193b752e3e23dfbc1aa7fd5f4806e48d37f20794b/clikit-0.4.1-py2.py3-none-any.whl', ' Collecting shellingham<2.0,>=1.1', ' Using cached https://files.pythonhosted.org/packages/2d/ac/e8a34d4b3d24bf554f40651b2aac549a3fc7223725bf10fbdfe2083b6372/shellingham-1.3.1-py2.py3-none-any.whl', ' Collecting webencodings', ' Using cached https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl', ' Collecting six>=1.9', ' Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl', ' Collecting msgpack', ' Using cached https://files.pythonhosted.org/packages/74/0a/de673c1c987f5779b65ef69052331ec0b0ebd22958bda77a8284be831964/msgpack-0.6.2.tar.gz', ' Collecting lockfile>=0.9', ' Using cached https://files.pythonhosted.org/packages/c8/22/9460e311f340cb62d26a38c419b1381b8593b0bb6b5d1f056938b086d362/lockfile-0.12.2-py2.py3-none-any.whl', ' Collecting ptyprocess>=0.5', ' Using cached https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl', ' Collecting secretstorage; sys_platform == "linux"', ' Using cached https://files.pythonhosted.org/packages/82/59/cb226752e20d83598d7fdcabd7819570b0329a61db07cfbdd21b2ef546e3/SecretStorage-3.1.1-py3-none-any.whl', ' Collecting zipp>=0.5', ' Using cached https://files.pythonhosted.org/packages/74/3d/1ee25a26411ba0401b43c6376d2316a71addcc72ef8690b101b4ea56d76a/zipp-0.6.0-py2.py3-none-any.whl', ' Collecting setuptools', ' Using cached https://files.pythonhosted.org/packages/54/28/c45d8b54c1339f9644b87663945e54a8503cfef59cf0f65b3ff5dd17cf64/setuptools-42.0.2-py2.py3-none-any.whl', ' Collecting attrs>=17.4.0', ' Using cached https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl', ' Collecting idna<2.9,>=2.5', ' Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl', ' Collecting chardet<3.1.0,>=3.0.2', ' Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl', ' Collecting certifi>=2017.4.17', ' Using cached https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl', ' Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1', ' Using cached https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl', ' Collecting pastel<0.2.0,>=0.1.0', ' Using cached https://files.pythonhosted.org/packages/09/b9/ca6434777928cc4e25cd17a8d2a913f3c2877ce54c5a7b7c18bf646ff257/pastel-0.1.1-py2.py3-none-any.whl', ' Collecting pylev<2.0,>=1.3', ' Using cached https://files.pythonhosted.org/packages/40/1c/7dff1d242bf1e19f9c6202f0ba4e6fd18cc7ecb8bc85b17b2d16c806e228/pylev-1.3.0-py2.py3-none-any.whl', ' Collecting cryptography', ' Using cached https://files.pythonhosted.org/packages/be/60/da377e1bed002716fb2d5d1d1cab720f298cb33ecff7bf7adea72788e4e4/cryptography-2.8.tar.gz', ' Installing build dependencies: started', " Installing build dependencies: finished with status 'error'", ' ERROR: Command errored out with exit status 1:', ' command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-kz9j2top/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- \'setuptools>=40.6.0\' wheel \'cffi>=1.8,!=1.11.3; platform_python_implementation != \'"\'"\'PyPy\'"\'"\'\'', ' cwd: None', ' Complete output (103 lines):', ' Collecting setuptools>=40.6.0', ' Using cached https://files.pythonhosted.org/packages/54/28/c45d8b54c1339f9644b87663945e54a8503cfef59cf0f65b3ff5dd17cf64/setuptools-42.0.2-py2.py3-none-any.whl', ' Collecting wheel', ' Using cached https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl', ' Collecting cffi!=1.11.3,>=1.8', ' Using cached https://files.pythonhosted.org/packages/2d/bf/960e5a422db3ac1a5e612cb35ca436c3fc985ed4b7ed13a1b4879006f450/cffi-1.13.2.tar.gz', ' Processing /root/.cache/pipenv/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511/pycparser-2.19-py2.py3-none-any.whl', ' Building wheels for collected packages: cffi', ' Building wheel for cffi (setup.py): started', " Building wheel for cffi (setup.py): finished with status 'error'", ' ERROR: Command errored out with exit status 1:', ' command: /usr/local/bin/python -u -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'/tmp/pip-install-mnl5c7mn/cffi/setup.py\'"\'"\'; __file__=\'"\'"\'/tmp/pip-install-mnl5c7mn/cffi/setup.py\'"\'"\';f=getattr(tokenize, \'"\'"\'open\'"\'"\', open)(__file__);code=f.read().replace(\'"\'"\'\\r\\n\'"\'"\', \'"\'"\'\\n\'"\'"\');f.close();exec(compile(code, __file__, \'"\'"\'exec\'"\'"\'))\' bdist_wheel -d /tmp/pip-wheel-w09zleho --python-tag cp37', ' cwd: /tmp/pip-install-mnl5c7mn/cffi/', ' Complete output (38 lines):', ' running bdist_wheel', ' running build', ' running build_py', ' creating build', ' creating build/lib.linux-x86_64-3.7', ' creating build/lib.linux-x86_64-3.7/cffi', ' copying cffi/recompiler.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/cparser.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/api.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/model.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/lock.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/__init__.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/commontypes.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/verifier.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/error.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/_embedding.h -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.7/cffi', ' warning: build_py: byte-compiling is disabled, skipping.', ' ', ' running build_ext', " building '_cffi_backend' extension", ' creating build/temp.linux-x86_64-3.7', ' creating build/temp.linux-x86_64-3.7/c', ' gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o', ' c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory', ' #include <ffi.h>', ' ^~~~~~~', ' compilation terminated.', " error: command 'gcc' failed with exit status 1", ' ----------------------------------------', ' ERROR: Failed building wheel for cffi', ' Running setup.py clean for cffi', ' Failed to build cffi', ' Installing collected packages: setuptools, wheel, pycparser, cffi', ' Running setup.py install for cffi: started', " Running setup.py install for cffi: finished with status 'error'", ' ERROR: Command errored out with exit status 1:', ' command: /usr/local/bin/python -u -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'/tmp/pip-install-mnl5c7mn/cffi/setup.py\'"\'"\'; __file__=\'"\'"\'/tmp/pip-install-mnl5c7mn/cffi/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-a3ja5ffv/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-kz9j2top/overlay --compile', ' cwd: /tmp/pip-install-mnl5c7mn/cffi/', ' Complete output (38 lines):', ' running install', ' running build', ' running build_py', ' creating build', ' creating build/lib.linux-x86_64-3.7', ' creating build/lib.linux-x86_64-3.7/cffi', ' copying cffi/recompiler.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/cparser.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/api.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/model.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/lock.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/__init__.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/commontypes.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/verifier.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/error.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/_embedding.h -> build/lib.linux-x86_64-3.7/cffi', ' copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.7/cffi', ' warning: build_py: byte-compiling is disabled, skipping.', ' ', ' running build_ext', " building '_cffi_backend' extension", ' creating build/temp.linux-x86_64-3.7', ' creating build/temp.linux-x86_64-3.7/c', ' gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o', ' c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory', ' #include <ffi.h>', ' ^~~~~~~', ' compilation terminated.', " error: command 'gcc' failed with exit status 1", ' ----------------------------------------', ' ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'/tmp/pip-install-mnl5c7mn/cffi/setup.py\'"\'"\'; __file__=\'"\'"\'/tmp/pip-install-mnl5c7mn/cffi/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-a3ja5ffv/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-kz9j2top/overlay --compile Check the logs for full command output.', ' ----------------------------------------', ' ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-kz9j2top/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- \'setuptools>=40.6.0\' wheel \'cffi>=1.8,!=1.11.3; platform_python_implementation != \'"\'"\'PyPy\'"\'"\'\' Check the logs for full command output.', ' ----------------------------------------', "ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-36izf7_5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'poetry>=0.12' Check the logs for full command output."]
ERROR: ERROR: Package installation failed...
最初,我能够安装并让它工作大约一周,但昨天我试图再次重建 docker 映像,但它失败了。
这是我的 Dockerfile:
FROM python:3.7-alpine
# Install nodejs, npm and vim
RUN apk add --update --no-cache nodejs npm vim curl
# To handle 'not get uid/gid'
RUN npm config set unsafe-perm true
# install serverless framework
RUN npm install -g serverless@${SLS_VERSION}
# install base dependencies
RUN apk add --no-cache build-base \
&& pip install pipenv awscli
# change work directory
WORKDIR /app
# Copy NPM dependencies files
ADD package.json package-lock.json ./
# install serverless dependencies
RUN npm install
# Copy python dependencies file
ADD Pipfile Pipfile.lock ./
# install python dependencies
RUN pipenv install --system --deploy --ignore-pipfile --dev
ADD docker-init.sh .
# Expose the ports to host
EXPOSE 3000 4000 4001
任何帮助表示赞赏。