1

When I ran the docker file code below

RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates \
        vim \
        git \
        python \
        python-pip \
        curl \
        wget \
        lsof \
        libmysqlclient-dev \
        python-dev \
        && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

#PYTHON requirements

ENV HTTPS_PROXY "https://gec-proxy-svr.homeoffice.wal-mart.com:8080/"

RUN python --version
RUN pip install pip --upgrade
RUN pip install  setuptools
RUN pip install setuptools --upgrade
RUN pip install git+https://github.com/PyMySQL/mysqlclient-python.git
RUN pip install -r requirements.txt

I got this error

Running setup.py install for mysqlclient: finished with status 'error'
        Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-LIEfN7/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-OFwDUp/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib.linux-x86_64-2.7
        copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
        creating build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
        copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
        creating build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
        running build_ext
        building '_mysql' extension
        creating build/temp.linux-x86_64-2.7
        x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
        unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
        error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

        ----------------------------------------
    Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-LIEfN7/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-OFwDUp/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-LIEfN7/

I tried installing libmysqlclient-dev and python-dev through apt-get update but it does not seem to address the issue.

4
  • 1
    Your Dockerfile is incomplete. Where's the FROM line? Commented Sep 5, 2018 at 22:07
  • 1
    on my system, this command (x86_64-linux-gnu-gcc) is part of the gcc package; is it installed correctly? Commented Sep 5, 2018 at 22:07
  • 1
    Possible duplicate of error: command 'x86_64-linux-gnu-gcc' when installing mysqlclient Commented Sep 5, 2018 at 22:53
  • FROM ubuntu:16.04 is what I had sorry but build_essential did the trick Commented Sep 6, 2018 at 0:34

1 Answer 1

5

Add build-essential to the apt-get install package list.

It seems that your base image is very basic, and does not have gcc installed, so you cannot compile anything.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much for your answer.
This is how to say "thanks" in SO speak: stackoverflow.com/help/someone-answers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.