Python3 Django3 Docker compose build issue on Windows machine – requirements.txt issue [duplicate]

  alpine, django, docker, python, windows

Im trying to do a docker compose build, and I’m getting the same error. Ive tried removing and installing setuptools and cairocffi iwth pip 3 but have had not joy.

Also tried going down a number of rabbit holes with finding out what gcc was but again no joy.

Even tried copying to Ubuntu machine and that was couldnt even get python and pip installed there.

Anyone have a clue what this error means or what I can try?

Docker compose:

version: '3.7'

services:
  web:
    build: ./koldfuzeon
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - ./koldfuzeon/:/usr/src/koldfuzeon/
    ports:
      - 8000:8000
    env_file:
      - ./.env.dev

Dockerfile

# pull official base image
FROM python:3.8.3-alpine

# set work directory
WORKDIR /usr/src/koldfuzeon

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt .

RUN pip install -r requirements.txt

# copy project
COPY . .

requirements.txt

appdirs==1.4.4
asgiref==3.2.10
asn1crypto==1.4.0
astroid==2.4.2
Babel==2.8.0
bleach==3.2.1
cairocffi==1.1.0
CairoSVG==2.4.2
certifi==2020.6.20
cffi==1.14.3
chardet==3.0.4
click==7.1.2
colorama==0.4.3
contextlib2==0.6.0.post1
coreapi==2.3.3
coreschema==0.0.4
cryptography==3.1.1
cssselect2==0.3.0
Cython==0.29.21
defusedxml==0.6.0
distlib==0.3.1
dj-database-url==0.5.0
Django==3.0.10
django-appconf==1.0.4
django-bootstrap3==14.1.0
django-classy-tags==2.0.0
django-cookie-law==2.0.3
django-countries==6.1.3
django-crispy-forms==1.9.2
django-enumfields==2.0.0
django-environ==0.4.5
django-filter==2.4.0
django-jinja==2.6.0
django-js-asset==1.2.2
django-mptt==0.11.0
django-parler==2.2
django-parler-rest==2.1
django-polymorphic==3.0.0
django-registration-redux==2.8
django-rest-swagger==2.2.0
django-reversion==3.0.8
django-timezone-field==4.0
djangorestframework==3.12.1
djangorestframework-jwt==1.11.0
easy-thumbnails==2.7
entrypoints==0.3
et-xmlfile==1.0.1
factory-boy==3.0.1
fake-factory==9999.9.9
Faker==4.1.3
filelock==3.0.12
html5lib==1.1
idna==2.10
isort==5.5.3
itypes==1.2.0
jdcal==1.4.1
Jinja2==2.11.2
jsonfield==3.1.0
keyring==21.4.0
keyrings.alt==3.5.2
lazy-object-proxy==1.4.3
lxml==4.5.2
Markdown==3.2.2
MarkupSafe==1.1.1
mccabe==0.6.1
openapi-codec==1.3.2
openpyxl==3.0.5
packaging==20.4
Pillow==7.2.0
pipenv==2020.8.13
pycparser==2.20
PyJWT==1.7.1
pylint==2.6.0
pylint-django==2.3.0
pylint-plugin-utils==0.6
pyparsing==2.4.7
pytest-runner==5.2
python-dateutil==2.8.1
pytz==2020.1
pywin32-ctypes==0.2.0
requests==2.24.0
setuptools==50.3.0
simplejson==3.17.2
six==1.15.0
spark-parser==1.8.9
sqlparse==0.3.1
text-unidecode==1.3
tinycss2==1.0.2
toml==0.10.1
typed-ast==1.4.1
uncompyle6==3.7.4
unicodecsv==0.14.1
Unidecode==1.1.1
uritemplate==3.0.1
urllib3==1.25.10
virtualenv==20.0.31
virtualenv-clone==0.5.4
webencodings==0.5.1
wrapt==1.12.1
xdis==5.0.4
xlrd==1.2.0

Error:

Collecting cairocffi==1.1.0
Downloading cairocffi-1.1.0.tar.gz (68 kB)
    ERROR: Command errored out with exit status 1:
    command: /usr/local/bin/python -c 'import sys, setuptools, 
tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8sbei979/cairocffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8sbei979/cairocffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-8yi6_x9h
        cwd: /tmp/pip-install-8sbei979/cairocffi/
    Complete output (87 lines):
    ERROR: Command errored out with exit status 1:
    command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-3n1qjrtl/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-3n1qjrtl/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9ha3u9ea
        cwd: /tmp/pip-wheel-3n1qjrtl/cffi/
    Complete output (50 lines):
    unable to execute 'gcc': No such file or directory        
    unable to execute 'gcc': No such file or directory        

        No working compiler found, or bogus compiler options passed to
        the compiler from Python's standard "distutils" module.  See
        the error messages above.  Likely, the problem is not 
related
        to CFFI but generic to the setup.py of any Python package that
        tries to compile C code.  (Hints: on OS/X 10.8, for errors about
        -mno-fused-madd see http://stackoverflow.com/questions/22313407/
        Otherwise, see https://wiki.python.org/moin/CompLangPython or
        the IRC channel #python on irc.freenode.net.)

        Trying to continue anyway.  If you are trying to install CFFI from
        a build done in a different context, you can ignore this warning.

    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi  
    copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi  
    copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi   
    copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi    
    copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
    warning: build_py: byte-compiling is disabled, skipping.  

    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/c
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv 
-O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi 
-I/usr/include/libffi -I/usr/local/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o      
    unable to execute 'gcc': No such file or directory        
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
    ERROR: Failed building wheel for cffi
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
    File "/usr/local/lib/python3.8/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
    File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp8r3x0z8e', '--quiet', 'cffi>=1.1.0']' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-8sbei979/cairocffi/setup.py", line 
10, in <module>
        setup(
    File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 160, in setup
        _install_setup_requires(attrs)
    File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 155, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
    File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 695, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(     
    File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 781, in resolve
        dist = best[req.key] = env.best_match(
    File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
    File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1078, in obtain
        return installer(requirement)
    File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
        return fetch_build_egg(self, req)
    File "/usr/local/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp8r3x0z8e', '--quiet', 'cffi>=1.1.0']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Service 'web' failed to build : The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1     

Source: Windows Questions

LEAVE A COMMENT