Can't install fasttext on docker container

Viewed 972

I am trying to build a python docker container.

Here is my dockerfile:

# syntax=docker/dockerfile:1
FROM python:3.8-slim
WORKDIR /src
COPY req.ini req.ini
RUN apt-get update
RUN pip install --upgrade pip setuptools wheel
RUN pip install -r req.ini
COPY . .
CMD ["python3","flask","run","--host=0.0.0.0"]

and in my req.ini file looks like this:

Flask fasttext gensim nltk scipy pandas numpy

But when I run docker build --tag python-app. , I get the following error:

#15 11.25   Building wheel for fasttext (setup.py): finished with status 'error'
#15 11.26   error: subprocess-exited-with-error
#15 11.26
#15 11.26   × python setup.py bdist_wheel did not run successfully.
#15 11.26   │ exit code: 1
#15 11.26   ╰─> [42 lines of output]

#15 11.26   ERROR: Failed building wheel for fasttext
#15 11.26   Running setup.py clean for fasttext
#15 11.38 Failed to build fasttext
#15 15.60   Running setup.py install for fasttext: finished with status 'error'
#15 15.61   error: subprocess-exited-with-error
#15 15.61
#15 15.61   × Running setup.py install for fasttext did not run successfully.
#15 15.61   │ exit code: 1
#15 15.61   ╰─> [46 lines of output]
#15 15.61       /usr/local/lib/python3.8/site-packages/setuptools/dist.py:731: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead

#15 15.61 × Encountered error while trying to install package.
#15 15.61 ╰─> fasttext
#15 15.61
#15 15.61 note: This is an issue with the package mentioned above, not pip.

------
executor failed running [/bin/sh -c pip install -r req.ini]: exit code: 1

What am I doing wrong?

1 Answers

You can add this to Dockerfile to get the C++11 package:

RUN apt-get update &&\
    apt-get install --no-install-recommends --yes build-essential
Related