I'm building a docker container that uses this image. (uwsgi-nginx-flask) This is based on an Alpine Linux image.
The latest python version available in this container is python 3.8.
I developed my flask application on Python 3.9. One of the python package dependencies is lxml
. When I tried installing this, it throws the error given below.
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitnq3gdzvk.c -o tmp/xmlXPathInitnq3gdzvk.o
unable to execute 'cc': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for lxml
unable to execute 'cc': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
This is my Dockerfile
FROM tiangolo/uwsgi-nginx-flask:python3.8-alpine
RUN apk add libxml2-dev
RUN apk --update add bash nano
RUN apk --update add --no-cache python3
RUN python --version
RUN mkdir -p /var/www/app/
RUN pip3 install --no-cache --upgrade pip setuptools
WORKDIR /var/www/app/
COPY . /var/www/app/
ENV STATIC_URL /static
ENV STATIC_PATH /var/www/app/static
RUN pip3 install -r requirements.txt
You can see that I even tried to install libxml2
on the alpine image as it is considered a dependency. But that doesn't work.