I have the following dockerfile:
FROM ubuntu:20.04
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
wget \
build-essential \
curl \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN wget --no-check-certificate -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash miniconda.sh -b \
&& rm -f miniconda.sh
ENV PATH="/root/miniconda3/bin:${PATH}"
WORKDIR /home
#COPY download_model.sh download_model.sh
#RUN /bin/bash /home/download_model.sh
RUN conda config --set ssl_verify false
#RUN curl -I https://repo.anaconda.com/pkgs/main/linux-64/current_repodata.json -k
RUN conda install pytorch==1.4.0 torchvision==0.5.0 cpuonly -c pytorch
COPY requirements.txt requirements.txt
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt
#RUN pip install -r requirements.txt
COPY m39v1.tar ./
RUN tar -xvf m39v1.tar && rm -f m39v1.tar
COPY src src/
COPY test_bin test_bin/
COPY run_paraphraser.py run_paraphraser.py
ENTRYPOINT ["python", "run_paraphraser.py"]
I'm having problems with running pip install, more specifically i've had to replace this command RUN pip install -r requirements.txt with RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt
Otherwise i was getting this wierd ssl certificate error:
#12 8.692 Could not fetch URL https://pypi.org/simple/config/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/config/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))) - skipping
#12 8.694 ERROR: Could not find a version that satisfies the requirement config (from versions: none)
#12 8.695 ERROR: No matching distribution found for config
#12 9.195 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))) - skipping
#12 ERROR: executor failed running [/bin/sh -c pip install -r requirements.txt config --global http.sslVerify false]: exit code:
I'm on a company laptop, however the problem arised only when trying to reach the website from docker, i noticed the problem when i added this line RUN curl -I https://pypi.org/simple/pip/ to the dockerfile to test connection to pip:
#10 [ 7/14] RUN curl -I https://pypi.org/simple/pip/
#10 sha256:95fa072f708fe705a1d5a9f7af20972255a078ce1df2cf90ad52a4d9a844ec40
#10 0.378 % Total % Received % Xferd Average Speed Time Time Time Current
#10 0.378 Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
#10 0.412 curl: (77) error setting certificate verify locations:
#10 0.412 CAfile: /etc/ssl/certs/ca-certificates.crt
#10 0.412 CApath: /etc/ssl/certs
#10 ERROR: executor failed running [/bin/sh -c curl -I https://pypi.org/simple/pip/]: exit code: 77
As i've mentioned replacing pip install with this trusted version seemed to work initially RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt
However when building the dockerfile i ended up with another error which i can't really wrap my head around:
#13 [ 9/14] RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt
#13 sha256:1e3540de7554d95d43c31a02a3079a9d8c5a8104255b93ca63d4dd006e1df31e
#13 0.881 Collecting sentencepiece==0.1.86
#13 1.057 Downloading sentencepiece-0.1.86-cp37-cp37m-manylinux1_x86_64.whl (1.0 MB)
#13 1.368 Collecting fairseq==0.9.0
#13 3.330 Downloading fairseq-0.9.0.tar.gz (306 kB)
#13 12.30 ERROR: Command errored out with exit status 1:
#13 12.30 command: /root/miniconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_2im9ux1/fairseq/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_2im9ux1/fairseq/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-_2im9ux1/fairseq/pip-egg-info
#13 12.30 cwd: /tmp/pip-install-_2im9ux1/fairseq/
#13 12.30 Complete output (39 lines):
#13 12.30 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /simple/cython/
#13 12.30 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /simple/cython/
#13 12.30 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /simple/cython/
#13 12.30 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /simple/cython/
#13 12.30 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /simple/cython/
#13 12.30 ERROR: Could not find a version that satisfies the requirement cython (from versions: none)
#13 12.30 ERROR: No matching distribution found for cython
#13 12.30 /root/miniconda3/lib/python3.7/site-packages/setuptools/installer.py:30: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
#13 12.30 SetuptoolsDeprecationWarning,
#13 12.30 Traceback (most recent call last):
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
#13 12.30 subprocess.check_call(cmd)
#13 12.30 File "/root/miniconda3/lib/python3.7/subprocess.py", line 363, in check_call
#13 12.30 raise CalledProcessError(retcode, cmd)
#13 12.30 subprocess.CalledProcessError: Command '['/root/miniconda3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp91n1bbee', '--quiet', 'cython']' returned non-zero exit status 1.
#13 12.30
#13 12.30 The above exception was the direct cause of the following exception:
#13 12.30
#13 12.30 Traceback (most recent call last):
#13 12.30 File "<string>", line 1, in <module>
#13 12.30 File "/tmp/pip-install-_2im9ux1/fairseq/setup.py", line 161, in <module>
#13 12.30 zip_safe=False,
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 86, in setup
#13 12.30 _install_setup_requires(attrs)
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
#13 12.30 dist.fetch_build_eggs(dist.setup_requires)
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/setuptools/dist.py", line 878, in fetch_build_eggs
#13 12.30 replace_conflicting=True,
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 791, in resolve
#13 12.30 replace_conflicting=replace_conflicting
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1075, in best_match
#13 12.30 return self.obtain(req, installer)
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1087, in obtain
#13 12.30 return installer(requirement)
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/setuptools/dist.py", line 945, in fetch_build_egg
#13 12.30 return fetch_build_egg(self, req)
#13 12.30 File "/root/miniconda3/lib/python3.7/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
#13 12.30 raise DistutilsError(str(e)) from e
#13 12.30 distutils.errors.DistutilsError: Command '['/root/miniconda3/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp91n1bbee', '--quiet', 'cython']' returned non-zero exit status 1.
#13 12.30 ----------------------------------------
#13 12.31 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#13 ERROR: executor failed running [/bin/sh -c pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt]: exit code: 1
i've also tried to update certificates by adding:
RUN apt-get install ca-certificates -y
RUN update-ca-certificates
with no success. It could be important to know that i've also had the same issue with conda install section: RUN conda install pytorch==1.4.0 torchvision==0.5.0 cpuonly -c pytorch
and i've managed to find a workaround by disabling the certificate verification: RUN conda config --set ssl_verify false
What should i do? thank you!
Related
I want to up flask app with a container on AWS App Runner but when I creating Docker Images I getting error. In requirements.txt file pymssql library importing error.
Here is requirements.txt file:
flask
jsonify
pandas
pymssql
numpy
jwt
Here is Dockerfile:
FROM python:3.10
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip install -r requirements.txt
COPY . /app
EXPOSE 8081
CMD ["python", "app.py" ]
When building Docker images I getting this error
#8 12.28
#8 12.28 × Building wheel for pymssql (pyproject.toml) did not run successfully.
#8 12.28 │ exit code: 1
#8 12.28 ╰─> [25 lines of output]
#8 12.28 setup.py: platform.system() => Linux
#8 12.28 setup.py: platform.architecture() => ('64bit', 'ELF')
#8 12.28 setup.py: platform.libc_ver() => ('glibc', '2.31')
#8 12.28 setup.py: include_dirs => []
#8 12.28 setup.py: library_dirs => []
#8 12.28 running bdist_wheel
#8 12.28 running build
#8 12.28 running build_py
#8 12.28 creating build
#8 12.28 creating build/lib.linux-aarch64-cpython-310
#8 12.28 creating build/lib.linux-aarch64-cpython-310/pymssql
#8 12.28 copying src/pymssql/__init__.py -> build/lib.linux-aarch64-cpython-310/pymssql
#8 12.28 running build_ext
#8 12.28 cythoning src/pymssql/_mssql.pyx to src/pymssql/_mssql.c
#8 12.28 cythoning src/pymssql/_pymssql.pyx to src/pymssql/_pymssql.c
#8 12.28 building 'pymssql._mssql' extension
#8 12.28 creating build/temp.linux-aarch64-cpython-310
#8 12.28 creating build/temp.linux-aarch64-cpython-310/src
#8 12.28 creating build/temp.linux-aarch64-cpython-310/src/pymssql
#8 12.28 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.10 -c src/pymssql/_mssql.c -o build/temp.linux-aarch64-cpython-310/src/pymssql/_mssql.o -DMSDBLIB
#8 12.28 src/pymssql/_mssql.c:747:10: fatal error: sqlfront.h: No such file or directory
#8 12.28 747 | #include "sqlfront.h"
#8 12.28 | ^~~~~~~~~~~~
#8 12.28 compilation terminated.
#8 12.28 error: command '/usr/bin/gcc' failed with exit code 1
#8 12.28 [end of output]
#8 12.28
#8 12.28 note: This error originates from a subprocess, and is likely not a problem with pip.
#8 12.28 ERROR: Failed building wheel for pymssql
#8 12.28 Successfully built jsonify
#8 12.28 Failed to build pymssql
#8 12.28 ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects
#8 12.28
#8 12.28 [notice] A new release of pip available: 22.2.2 -> 22.3.1
#8 12.28 [notice] To update, run: pip install --upgrade pip
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code:
I want to use jupyter notbook by using Anaconda3 in docker ubuntu, but when I create an image with docker build --platform linux/amd64 . the following error occurs.
How can I solve it?
#8 141.1
#8 141.1 2022-05-05 04:21:55 (3.62 MB/s) - 'Anaconda3-2019.10-Linux-x86_64.sh' saved [530308481/530308481]
#8 141.1
#8 141.3 PREFIX=/opt/anaconda3
#8 143.4 Unpacking payload ...
[96] Failed to execute script entry_point concurrent.futures.process._RemoteTraceback:
#8 151.7 '''
#8 151.7 Traceback (most recent call last):
#8 151.7 File "concurrent/futures/process.py", line 367, in _queue_management_worker
#8 151.7 File "multiprocessing/connection.py", line 251, in recv
#8 151.7 TypeError: __init__() missing 1 required positional argument: 'msg'
#8 151.7 '''
#8 151.7
#8 151.7 The above exception was the direct cause of the following exception:
#8 151.7
#8 151.7 Traceback (most recent call last):
#8 151.7 File "entry_point.py", line 71, in <module>
#8 151.7 File "concurrent/futures/process.py", line 483, in _chain_from_iterable_of_lists
#8 151.7 File "concurrent/futures/_base.py", line 598, in result_iterator
#8 151.7 File "concurrent/futures/_base.py", line 435, in result
#8 151.7 File "concurrent/futures/_base.py", line 384, in __get_result
#8 151.7 concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
------ executor failed running [/bin/sh -c wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh && sh /opt/Anaconda3-2019.10-Linux-x86_64.sh -b -p /opt/anaconda3 && rm -f Anaconda3-2019.10-Linux-x86_64.sh]: exit code: 1
The Dockerfile is like below:
FROM ubuntu:latest
# update
RUN apt-get -y update && apt-get install -y \
sudo \
wget \
vim
#install anaconda3
WORKDIR /opt
# download anaconda package and install anaconda
# archive -> https://repo.continuum.io/archive/
RUN wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh && \
sh /opt/Anaconda3-2019.10-Linux-x86_64.sh -b -p /opt/anaconda3 && \
rm -f Anaconda3-2019.10-Linux-x86_64.sh
# set path
ENV PATH /opt/anaconda3/bin:$PATH
# update pip and conda
RUN pip install --upgrade pip
WORKDIR /
RUN mkdir /work
# execute jupyterlab as a default command
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--LabApp.token=''"]
Mac 12.3.1 Apple M1
Docker desktop for Mac 4.7.1
It can be a space issue during the installation, I was getting the exact error. If you accept the default option to install Anaconda on the “default path” Anaconda is installed in your user home directory, where space can be an issue. For me it got resolved when changed the default directory to some other directory during installation .You can also refer this page for similar issues- https://github.com/conda/conda/issues/10143
This is my Dockerfile:
FROM alpine:3.14
# Install python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
RUN apk add python3-dev # for python3.x installs
RUN apk add musl-dev
RUN apk add gcc
RUN mkdir -p /usr/src/tap-stashstock
RUN mkdir -p /usr/singer
WORKDIR /usr/src/tap-stashstock
ADD . /usr/src/tap-stashstock
ADD singer /usr/singer
RUN pip3 install --upgrade .
This works and then I run docker run -it stashstock-to-bigquery pip3 install target-bigquery which results in this error
Collecting grpcio<2.0dev,>=1.38.1
Downloading grpcio-1.44.0.tar.gz (21.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.4/21.4 MB 3.9 MB/s eta 0:00:00
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-4wuwnk4b/grpcio_429c1ed72b4244a0a71ac7e9f1ec81c6/setup.py", line 256, in <module>
if check_linker_need_libatomic():
File "/tmp/pip-install-4wuwnk4b/grpcio_429c1ed72b4244a0a71ac7e9f1ec81c6/setup.py", line 203, in check_linker_need_libatomic
cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'],
File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'c++'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
What am I missing from my Dockerfile?
This error may for not having a C/C++ compiler.
Try install gcc and build-essensial before pip installation.
Please follow the steps given in
https://github.com/grpc/issues/24556
Context
I have a jenkins that builds a docker image for a raspberry pi 2.
It is using buildx to emulate the ArmV7 environment during build.
This worked great until recently I got random errors during installing the apk packages.
Dockerfile
FROM python:3-alpine
# picam python module
ARG PICAMERA_RELEASE_ADDRESS="{private_repo}"
# Ardafruit python module
ARG ARDAFRUIT_RELEASE_URL="{private_repo}"
WORKDIR /tmp
ENV LD_LIBRARY_PATH="/opt/vc/lib"
COPY ./files /app
RUN apk add --no-cache --verbose \
raspberrypi-libs \
bluez \
bluez-deprecated \
unzip \
git \
glib-dev \
gobject-introspection-dev \
cairo-dev \
py3-cairo \
openssl-dev \
nano \
bash \
alpine-sdk \
&& git clone ${PICAMERA_RELEASE_ADDRESS} \
&& cd picamera \
&& su -c "python3 setup.py install" \
&& cd /tmp/ \
&& git clone ${ARDAFRUIT_RELEASE_URL} \
&& cd Adafruit_Python_DHT \
&& su -c "python3 setup.py install --force-pi2" \
&& cd /tmp/ \
&& CFLAGS="-fcommon" pip3 install \
btlewrap==0.0.* \
Flask==2.* \
waitress==2.* \
flask-cors==3.* \
miflora==0.* \
colorzero==2.* \
RPi.GPIO==0.7.* \
&& cd /tmp/ \
&& chmod +x /app/main.py \
&& chmod +x /app/healthcheck.py \
&& chmod +x /app/harden.sh \
&& apk del \
unzip \
git \
glib-dev \
gobject-introspection-dev \
cairo-dev \
py3-cairo \
openssl-dev \
nano \
bash \
alpine-sdk \
libc-utils \
&& rm -rf /tmp/* \
&& sh /app/harden.sh \
&& rm -f /app/harden.sh \
&& rm -f /bin/rm
# finalize
WORKDIR /app
EXPOSE 80
ENTRYPOINT [ "python3" ]
CMD [ "/app/main.py" ]
HEALTHCHECK --interval=1m --timeout=10s \
CMD python3 /app/healthcheck.py
Pipeline for the build
pipeline {
environment {
registryCredential = ''
registryURL = ''
scmURL = ''
scmCredential = ''
dockerImage = ''
working_branch = ''
working_dir = ''
}
agent any
stages {
stage('Cloning Git') {
steps {
git(
url: scmURL,
credentialsId: scmCredential,
branch: working_branch
)
}
}
stage('docker login') {
steps {
sh '$(aws ecr get-login --no-include-email --region eu-central-1)'
}
}
stage('Build Image and push it') {
steps{
dir(working_dir){
sh "docker build -t $registryURL:latest --platform linux/arm/v7 --push ."
}
}
}
}
}
Jenkins Output
#7 [3/5] COPY ./files /app
#7 DONE 0.0s
#8 [4/5] RUN apk fix && apk add --no-cache --verbose raspberrypi-libs bluez bluez-deprecated unzip git glib-dev gobject-introspection-dev cairo-dev py3-cairo openssl-dev nano bash alpine-sdk && apk fix && git clone https://{private_repo} && cd picamera && su -c "python3 setup.py install" && cd /tmp/ && git clone https://{private_repo} && cd Adafruit_Python_DHT && su -c "python3 setup.py install --force-pi2" && cd /tmp/ && CFLAGS="-fcommon" pip3 install btlewrap==0.0.* Flask==2.* waitress==2.* flask-cors==3.* miflora==0.* colorzero==2.* RPi.GPIO==0.7.* && cd /tmp/ && chmod +x /app/main.py && chmod +x /app/healthcheck.py && chmod +x /app/harden.sh && apk del unzip git glib-dev gobject-introspection-dev cairo-dev py3-cairo openssl-dev nano bash alpine-sdk libc-utils && rm -rf /tmp/* && sh /app/harden.sh && rm -f /app/harden.sh && rm -f /bin/rm
#8 0.337 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#8 1.611 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#8 3.302 OK: 11 MiB in 37 packages
#8 3.581 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#8 4.617 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#8 6.349 (1/130) Installing fakeroot (1.25.3-r3)
#8 6.382 (2/130) Installing openssl (1.1.1l-r0)
#8 6.465 (3/130) Installing libattr (2.5.1-r0)
#8 6.487 (4/130) Installing attr (2.5.1-r0)
#8 6.517 (5/130) Installing libacl (2.2.53-r0)
#8 6.540 (6/130) Installing tar (1.34-r0)
#8 6.632 (7/130) Installing pkgconf (1.7.4-r0)
#8 6.667 (8/130) Installing patch (2.7.6-r7)
#8 6.715 (9/130) Installing libstdc++ (10.3.1_git20210424-r2)
#8 6.894 (10/130) Installing lzip (1.22-r0)
#8 6.929 (11/130) Installing brotli-libs (1.0.9-r5)
#8 7.062 (12/130) Installing nghttp2-libs (1.43.0-r0)
#8 7.101 (13/130) Installing libcurl (7.79.1-r0)
#8 7.185 (14/130) Installing curl (7.79.1-r0)
#8 7.244 (15/130) Installing abuild (3.8.0_rc4-r0)
#8 7.285 Executing abuild-3.8.0_rc4-r0.pre-install
#8 7.296 ERROR: abuild-3.8.0_rc4-r0.pre-install: script exited with error 1
#8 7.321 (16/130) Installing binutils (2.35.2-r2)
#8 7.910 (17/130) Installing libmagic (5.40-r1)
#8 8.140 (18/130) Installing file (5.40-r1)
#8 8.162 (19/130) Installing libgomp (10.3.1_git20210424-r2)
#8 8.226 (20/130) Installing libatomic (10.3.1_git20210424-r2)
#8 8.249 (21/130) Installing libgphobos (10.3.1_git20210424-r2)
#8 8.735 (22/130) Installing gmp (6.2.1-r0)
#8 8.805 (23/130) Installing isl22 (0.22-r0)
#8 8.991 (24/130) Installing mpfr4 (4.1.0-r0)
#8 9.056 (25/130) Installing mpc1 (1.2.1-r0)
#8 9.093 (26/130) Installing gcc (10.3.1_git20210424-r2)
#8 13.99 (27/130) Installing musl-dev (1.2.2-r3)
#8 14.57 (28/130) Installing libc-dev (0.7.2-r3)
#8 14.59 (29/130) Installing g++ (10.3.1_git20210424-r2)
#8 18.44 (30/130) Installing make (4.3-r0)
#8 18.48 (31/130) Installing fortify-headers (1.1-r1)
#8 18.50 (32/130) Installing build-base (0.5-r2)
#8 18.51 (33/130) Installing pcre2 (10.36-r0)
#8 18.58 (34/130) Installing git (2.32.0-r0)
#8 19.63 (35/130) Installing alpine-sdk (1.0-r1)
#8 19.65 (36/130) Installing bash (5.1.4-r0)
#8 19.80 Executing bash-5.1.4-r0.post-install
#8 19.82 ERROR: bash-5.1.4-r0.post-install: script exited with error 1
#8 19.82 (37/130) Installing dbus-libs (1.12.20-r2)
#8 19.88 (38/130) Installing dbus (1.12.20-r2)
#8 19.93 Executing dbus-1.12.20-r2.pre-install
#8 19.94 ERROR: dbus-1.12.20-r2.pre-install: script exited with error 1
#8 19.96 Executing dbus-1.12.20-r2.post-install
#8 19.97 ERROR: dbus-1.12.20-r2.post-install: script exited with error 1
#8 19.97 (39/130) Installing libblkid (2.37.2-r0)
#8 20.04 (40/130) Installing libmount (2.37.2-r0)
#8 20.09 (41/130) Installing pcre (8.44-r0)
#8 20.15 (42/130) Installing glib (2.68.3-r0)
#8 20.46 (43/130) Installing json-c (0.15-r1)
#8 20.52 (44/130) Installing eudev-libs (3.2.10-r0)
#8 20.59 (45/130) Installing bluez (5.58-r2)
#8 20.91 (46/130) Installing bluez-deprecated (5.58-r2)
#8 21.06 (47/130) Installing libxau (1.0.9-r0)
#8 21.08 (48/130) Installing libmd (1.0.3-r0)
#8 21.11 (49/130) Installing libbsd (0.11.3-r0)
#8 21.14 (50/130) Installing libxdmcp (1.1.3-r0)
#8 21.16 (51/130) Installing libxcb (1.14-r2)
#8 21.27 (52/130) Installing libx11 (1.7.2-r0)
#8 21.57 (53/130) Installing libxrender (0.9.10-r3)
#8 21.59 (54/130) Installing libxext (1.3.4-r0)
#8 21.61 (55/130) Installing libpng (1.6.37-r1)
#8 21.65 (56/130) Installing freetype (2.10.4-r1)
#8 21.76 (57/130) Installing fontconfig (2.13.1-r4)
#8 21.86 (58/130) Installing pixman (0.40.0-r2)
#8 21.94 (59/130) Installing cairo (1.16.0-r3)
#8 22.10 (60/130) Installing cairo-tools (1.16.0-r3)
#8 22.20 (61/130) Installing expat-dev (2.4.1-r0)
#8 22.23 (62/130) Installing brotli-dev (1.0.9-r5)
#8 22.26 (63/130) Installing zlib-dev (1.2.11-r3)
#8 22.30 (64/130) Installing libpng-dev (1.6.37-r1)
#8 22.34 (65/130) Installing freetype-dev (2.10.4-r1)
#8 22.46 (66/130) Installing blkid (2.37.2-r0)
#8 22.50 (67/130) Installing libcap-ng (0.8.2-r0)
#8 22.52 (68/130) Installing setpriv (2.37.2-r0)
#8 22.55 (69/130) Installing libsmartcols (2.37.2-r0)
#8 22.60 (70/130) Installing findmnt (2.37.2-r0)
#8 22.64 (71/130) Installing mcookie (2.37.2-r0)
#8 22.67 (72/130) Installing hexdump (2.37.2-r0)
#8 22.70 (73/130) Installing lsblk (2.37.2-r0)
#8 22.75 (74/130) Installing libfdisk (2.37.2-r0)
#8 22.84 (75/130) Installing sfdisk (2.37.2-r0)
#8 22.87 (76/130) Installing cfdisk (2.37.2-r0)
#8 22.91 (77/130) Installing partx (2.37.2-r0)
#8 22.95 (78/130) Installing flock (2.37.2-r0)
#8 22.97 (79/130) Installing logger (2.37.2-r0)
#8 23.00 (80/130) Installing uuidgen (2.37.2-r0)
#8 23.02 (81/130) Installing libeconf (0.3.8-r1)
#8 23.04 (82/130) Installing util-linux (2.37.2-r0)
#8 23.37 (83/130) Installing util-linux-dev (2.37.2-r0)
#8 23.57 (84/130) Installing fontconfig-dev (2.13.1-r4)
#8 23.60 (85/130) Installing xorgproto (2021.4-r0)
#8 23.82 (86/130) Installing libxau-dev (1.0.9-r0)
#8 23.85 (87/130) Installing xcb-proto (1.14.1-r2)
#8 23.91 (88/130) Installing libxdmcp-dev (1.1.3-r0)
#8 23.93 (89/130) Installing libxcb-dev (1.14-r2)
#8 24.08 (90/130) Installing xtrans (1.4.0-r1)
#8 24.13 (91/130) Installing libx11-dev (1.7.2-r0)
#8 24.18 (92/130) Installing libxext-dev (1.3.4-r0)
#8 24.22 (93/130) Installing libxrender-dev (0.9.10-r3)
#8 24.25 (94/130) Installing pixman-dev (0.40.0-r2)
#8 24.27 (95/130) Installing util-macros (1.19.3-r0)
#8 24.30 (96/130) Installing xcb-util (0.4.0-r3)
#8 24.32 (97/130) Installing xcb-util-dev (0.4.0-r3)
#8 24.35 (98/130) Installing cairo-gobject (1.16.0-r3)
#8 24.38 (99/130) Installing mpdecimal (2.5.1-r1)
#8 24.42 (100/130) Installing python3 (3.9.5-r1)
#8 28.02 (101/130) Installing gettext-asprintf (0.21-r0)
#8 28.04 (102/130) Installing libunistring (0.9.10-r1)
#8 28.25 (103/130) Installing gettext-libs (0.21-r0)
#8 28.39 (104/130) Installing libxml2 (2.9.12-r1)
#8 28.57 (105/130) Installing gettext (0.21-r0)
#8 28.70 (106/130) Installing gettext-dev (0.21-r0)
#8 28.95 (107/130) Installing bzip2-dev (1.0.8-r1)
#8 28.97 (108/130) Installing libxml2-utils (2.9.12-r1)
#8 29.00 (109/130) Installing libgpg-error (1.42-r0)
#8 29.07 (110/130) Installing libgcrypt (1.9.4-r0)
#8 29.22 (111/130) Installing libxslt (1.1.34-r1)
#8 29.28 (112/130) Installing docbook-xml (4.5-r6)
#8 29.47 Executing docbook-xml-4.5-r6.post-install
#8 29.47 ERROR: docbook-xml-4.5-r6.post-install: script exited with error 1
#8 29.48 (113/130) Installing docbook-xsl (1.79.2-r2)
#8 30.38 Executing docbook-xsl-1.79.2-r2.post-install
#8 30.39 (114/130) Installing linux-headers (5.10.41-r0)
#8 30.39 ERROR: docbook-xsl-1.79.2-r2.post-install: script exited with error 1
#8 31.04 (115/130) Installing libffi-dev (3.3-r2)
#8 31.09 (116/130) Installing libpcre16 (8.44-r0)
#8 31.14 (117/130) Installing libpcre32 (8.44-r0)
#8 31.19 (118/130) Installing libpcrecpp (8.44-r0)
#8 31.22 (119/130) Installing pcre-dev (8.44-r0)
#8 31.40 (120/130) Installing glib-dev (2.68.3-r0)
#8 31.68 (121/130) Installing cairo-dev (1.16.0-r3)
#8 31.72 (122/130) Installing libltdl (2.4.6-r7)
#8 31.76 (123/130) Installing libtool (2.4.6-r7)
#8 31.99 (124/130) Installing gobject-introspection (1.68.0-r1)
#8 32.10 (125/130) Installing gobject-introspection-dev (1.68.0-r1)
#8 32.61 (126/130) Installing nano (5.7-r2)
#8 32.68 (127/130) Installing openssl-dev (1.1.1l-r0)
#8 32.84 (128/130) Installing py3-cairo (1.20.1-r0)
#8 32.87 (129/130) Installing raspberrypi-libs (0.20200813-r0)
#8 33.12 (130/130) Installing unzip (6.0-r9)
#8 33.19 Executing busybox-1.33.1-r6.trigger
#8 33.33 Executing dbus-1.12.20-r2.trigger
#8 33.48 Executing glib-2.68.3-r0.trigger
#8 33.66 No schema files found: doing nothing.
#8 33.75 5 errors; 167 packages, 603 dirs, 10399 files, 282 MiB
#8 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c apk fix && apk add --no-cache --verbose raspberrypi-libs \t\tbluez bluez-deprecated \t\tunzip git \t\tglib-dev \t\tgobject-introspection-dev \t\tcairo-dev \t\tpy3-cairo \t\topenssl-dev \t\tnano bash alpine-sdk && apk fix && git clone ${PICAMERA_RELEASE_ADDRESS} && cd picamera && su -c \"python3 setup.py install\" && cd /tmp/ && git clone ${ARDAFRUIT_RELEASE_URL} && cd Adafruit_Python_DHT && su -c \"python3 setup.py install --force-pi2\" && cd /tmp/ && CFLAGS=\"-fcommon\" pip3 install btlewrap==0.0.* Flask==2.* waitress==2.* flask-cors==3.* miflora==0.* colorzero==2.* RPi.GPIO==0.7.* && cd /tmp/ && chmod +x /app/main.py && chmod +x /app/healthcheck.py && chmod +x /app/harden.sh && apk del \t\tunzip git \t\tglib-dev \t\tgobject-introspection-dev \t\tcairo-dev \t\tpy3-cairo \t\topenssl-dev \t\tnano bash alpine-sdk libc-utils && rm -rf /tmp/* && sh /app/harden.sh && rm -f /app/harden.sh && rm -f /bin/rm" did not complete successfully: exit code: 5
As you can see there are errors while installing abuild, bash, dbus, docbook-xml and docbook-xsl but these errors are not consistent, on the run before it were only docbook-xsl (the only consistent error) in the run after, abuild and dbus installed successfully.
I am not sure what causes the problem, or how to get more information about the error.
Running the build directly on the raspberry pi works of course, so it seems the error is located somewhere in the multi-arch configuration, but I am not sure what could have changed.
ok, looks like i found my solution here:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/12406
quote from Lyle Franklin:
I hit this error when trying to build a cross-platform ARM64 docker
image from a AMD64 host. However, running docker run --rm --privileged linuxkit/binfmt:v0.8 or update-binfmts --enable prior to running the build seems to avoid the issue. My understanding Docker
will try to use upstream QEMU if it is installed and registered with
the kernel, otherwise Docker will fallback to using a built-in forked
version of QEMU. The build error above only showed up for me with the
forked QEMU.
So I will probably add docker run --rm --privileged linuxkit/binfmt:v0.8 && update-binfmts --enable to my pipeline file if I encounter the error again, for now running it once solved the issue.
I'm using docker-backed lambdas with the AWS-provided base image for python3.8.
It looks like it tries to build matplotlib from scratch, then fails out with gcc related errors.
The repro is straightforward, just try to build the following Dockerfile:
FROM amazon/aws-lambda-python:3.8
RUN yum -y install gcc
RUN pip3 install --upgrade pip
RUN pip3 install matplotlib
Error:
#7 13.82 set build/lib.linux-x86_64-3.8/matplotlib/_version.py to '3.4.3'
#7 13.82 running build_ext
#7 13.82 creating tmp
#7 13.82 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/var/lang/include/python3.8 -c /tmp/tmpjr1hj4f1.cpp -o tmp/tmpjr1hj4f1.o -fvisibility=hidden
#7 13.82 gcc: error trying to exec 'cc1plus': execvp: No such file or directory
#7 13.82 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/var/lang/include/python3.8 -c /tmp/tmp74f416b5.cpp -o tmp/tmp74f416b5.o -fvisibility-inlines-hidden
#7 13.82 gcc: error trying to exec 'cc1plus': execvp: No such file or directory
#7 13.82 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/var/lang/include/python3.8 -c /tmp/tmp19pyjmxw.cpp -o tmp/tmp19pyjmxw.o -flto
#7 13.82 gcc: error trying to exec 'cc1plus': execvp: No such file or directory
#7 13.82 Extracting /project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
#7 13.82 Building freetype in build/freetype-2.6.1
#7 13.82 GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2.
#7 13.82 Please try
#7 13.82
#7 13.82 MAKE=<GNU make command name> ./configure
#7 13.82
#7 13.82 or
#7 13.82
#7 13.82 MAKE="makepp --norc-substitution" ./configure
#7 13.82 Traceback (most recent call last):
#7 13.82 File "<string>", line 1, in <module>
#7 13.82 File "/tmp/pip-install-v3njpp10/matplotlib_5bf0432199ce40b5a487eafc6a513cc3/setup.py", line 258, in <module>
#7 13.82 setup( # Finally, pass this all along to distutils to do the heavy lifting.
#7 13.82 File "/var/lang/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
#7 13.82 return distutils.core.setup(**attrs)
#7 13.82 File "/var/lang/lib/python3.8/distutils/core.py", line 148, in setup
#7 13.82 dist.run_commands()
#7 13.82 File "/var/lang/lib/python3.8/distutils/dist.py", line 966, in run_commands
#7 13.82 self.run_command(cmd)
#7 13.82 File "/var/lang/lib/python3.8/distutils/dist.py", line 985, in run_command
#7 13.82 cmd_obj.run()
#7 13.82 File "/var/lang/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
#7 13.82 return orig.install.run(self)
#7 13.82 File "/var/lang/lib/python3.8/distutils/command/install.py", line 545, in run
#7 13.82 self.run_command('build')
#7 13.82 File "/var/lang/lib/python3.8/distutils/cmd.py", line 313, in run_command
#7 13.82 self.distribution.run_command(command)
#7 13.82 File "/var/lang/lib/python3.8/distutils/dist.py", line 985, in run_command
#7 13.82 cmd_obj.run()
#7 13.82 File "/var/lang/lib/python3.8/distutils/command/build.py", line 135, in run
#7 13.82 self.run_command(cmd_name)
#7 13.82 File "/var/lang/lib/python3.8/distutils/cmd.py", line 313, in run_command
#7 13.82 self.distribution.run_command(command)
#7 13.82 File "/var/lang/lib/python3.8/distutils/dist.py", line 985, in run_command
#7 13.82 cmd_obj.run()
#7 13.82 File "/var/lang/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
#7 13.82 _build_ext.run(self)
#7 13.82 File "/var/lang/lib/python3.8/distutils/command/build_ext.py", line 340, in run
#7 13.82 self.build_extensions()
#7 13.82 File "/tmp/pip-install-v3njpp10/matplotlib_5bf0432199ce40b5a487eafc6a513cc3/setup.py", line 199, in build_extensions
#7 13.82 package.do_custom_build(env)
#7 13.82 File "/tmp/pip-install-v3njpp10/matplotlib_5bf0432199ce40b5a487eafc6a513cc3/setupext.py", line 596, in do_custom_build
#7 13.82 subprocess.check_call(
#7 13.82 File "/var/lang/lib/python3.8/subprocess.py", line 364, in check_call
#7 13.82 raise CalledProcessError(retcode, cmd)
#7 13.82 subprocess.CalledProcessError: Command '['./configure', '--with-zlib=no', '--with-bzip2=no', '--with-png=no', '--with-harfbuzz=no', '--enable-static', '--disable-shared']' returned non-zero exit status 1.
#7 13.82 ----------------------------------------
#7 13.83 ERROR: Command errored out with exit status 1: /var/lang/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v3njpp10/matplotlib_5bf0432199ce40b5a487eafc6a513cc3/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v3njpp10/matplotlib_5bf0432199ce40b5a487eafc6a513cc3/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-vdv6xdpv/install-record.txt --single-version-externally-managed --compile --install-headers /var/lang/include/python3.8/matplotlib Check the logs for full command output.
It seems like you're getting an error because of missing binaries that are needed to compile matplotlib.
Can you try to install the additional g++ package? It is usualy named gcc-c++ with the yum installer so:
FROM amazon/aws-lambda-python:3.8
RUN yum -y install gcc gcc-c++
RUN pip3 install --upgrade pip
RUN pip3 install matplotlib
the fix was to add compiler tools to the docker image before trying to compile matplotlib. I still don't know why this started failing for me, perhaps the base image was updated.
RUN yum -y groups mark install "Development Tools" && yum -y groups mark convert "Development Tools" && yum -y group install "Development Tools"
I'm running into the same issue and I think it is matplotlib's fault. They released a new version (3.4.3) 17h ago as of this writing. For me setting the version to the previous minor release, i.e. matplotlib==3.4.2 fixes it.
There were no issues until today with my lambda deployment and nothing in my code changed so I think it's something in the new release though I do not know what exactly.
I had the same problem and I was trying to install matplotlib in a docker container using an alpine image. For me the fix was the same as it was for #alex9311, but since I am on a docker alpine build, I was adding the following line to my image:
RUN apk update && apk add --no-cache build-base
I hope this helps. Only adding it as an answer so it doesn't get overlooked when it might help.
I was able to fix the problem by installing "make". In the error logs posted in the question there is a statement
GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2.
This is the cause of the matplotlib installation failure. The cause of the error is that the docker image is missing an installation of GNU make. The accepted answer installs all the packages in the "Development Tools" group (which includes make) which is not necessary. It will increase the docker image size which can be avoided by installing only "make".
FROM amazon/aws-lambda-python:3.8
RUN yum -y install gcc gcc-c++ make
RUN pip3 install --upgrade pip
RUN pip3 install matplotlib
The matplotlib installation was successful on installing make before installing matplotlib
Changing the version as Daniel suggested also worked for me. matplotlib==3.5.1 in my case worked.