Reputation: 7490
I have a python flask application which I want to deploy on ubuntu server with docker.
So I transferred my whole application folder to ubuntu directory.
Then with root user, I am trying to create a dockerfile in the application folder as below:
# Docker file for Support
# Pulling from base Python image
FROM python:3.7
# author of file
LABEL maintainer="Baktaawar"
# Set the working directory of the docker image
WORKDIR /support
COPY . /support
# packages that we need
RUN apt-get update \
&& apt-get install build-essential
RUN pip --no-cache-dir install -r requirements.txt
EXPOSE 8888
CMD ["python", "index.py"]
The requirements.txt file is the conda env packages list exported via
pip freeze> requirments.txt
These are the packages in that.
thinc==6.10.2
cytoolz==0.8.2
msgpack-numpy==0.4.1
msgpack-python==0.5.6
pathlib==1.0.1
termcolor==1.1.0
ujson==1.35
spacy==2.0.11
dash==0.26.2
dash-core-components==0.30.0rc1
dash-dangerously-set-inner-html==0.0.1
dash-html-components==0.11.0
dash-renderer==0.13.1
Flask==0.12.2
Flask-Compress==1.4.0
HTMLParser==0.0.2
matplotlib==2.1.2
matplotlib-venn==0.11.5
numpy==1.15.2
pandas==0.20.3
plotly==3.1.1
wordcloud==1.5.0
But when I run this via
docker build -t support .
It starts installing but at the very end it throws an error for cytoolz and gcc error.
I got the gcc installed via build-essential as shown in my dockerfile. Also using 3.7 instead of python3.6-slim to avoid other gcc issues.
tstate->exc_type = local_type;
^~
cytoolz/dicttoolz.c:9126:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~
cytoolz/dicttoolz.c:9127:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-oprwuva4/cytoolz/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-s_ua1t8c/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-oprwuva4/cytoolz/
The command '/bin/sh -c pip --no-cache-dir install -r requirements.txt' returned a non-zero code: 1
Upvotes: 0
Views: 1041
Reputation: 424
Run the following:
gcc --version
If it's not installed add the following package:
sudo apt-get install python3.6-dev
Upvotes: 1