Q&A

책을 따라하다가 막히는 부분이 있나요?
질문을 남겨주세요.

Docker Build 에러 질문드립니다.

3 years, 4 months ago

jinioji jinioji

안녕하세요.

Do It Django 책 덕분에 장고 열심히 공부 중에 있습니다.

현재 로컬 환경에서 블로그 작성은 모두 마친 상태로 「도커로 이사 준비하기」 부분 진행 중에 있습니다.

도커 관련 각종 설정 마친 상태로 도커 빌드 하면 잘 넘어가다가 다음과 같은 오류로 더 이상 진행이 되지 않습니다.

python version : 3.9.5

bootstrap version : 5.0

아래는 requirements.txt 내용입니다.

==================================

asgiref==3.3.4

backcall==0.2.0

beautifulsoup4==4.9.3

certifi==2021.5.30

cffi==1.14.5

chardet==4.0.0

colorama==0.4.4

crispy-bootstrap5==0.4

cryptography==3.4.7

decorator==5.0.9

defusedxml==0.7.1

Django==3.2.4

django-allauth==0.44.0

django-crispy-forms==1.12.0

django-extensions==3.1.3

django-markdownx==3.0.1

idna==3.2

ipython==7.24.1

ipython-genutils==0.2.0

jedi==0.18.0

Markdown==3.3.4

matplotlib-inline==0.1.2

oauthlib==3.1.1

parso==0.8.2

pickleshare==0.7.5

Pillow==8.2.0

prompt-toolkit==3.0.19

pycparser==2.20

Pygments==2.9.0

PyJWT==2.1.0

python3-openid==3.2.0

pytz==2021.1

requests==2.25.1

requests-oauthlib==1.3.0

soupsieve==2.2.1

sqlparse==0.4.1

traitlets==5.0.5

urllib3==1.26.5

wcwidth==0.2.5

==================================



아래는 에러 내용입니다.
==================================
Collecting cryptography==3.4.7
  Downloading cryptography-3.4.7.tar.gz (546 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /tmp/pip-standalone-pip-j5e9jkuc/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-yrjqd7km/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4'
       cwd: None
  Complete output (150 lines):
  Collecting setuptools>=40.6.0
    Downloading setuptools-57.0.0-py3-none-any.whl (821 kB)
  Collecting wheel
    Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
  Collecting cffi>=1.12
    Using cached cffi-1.14.5.tar.gz (475 kB)
  Collecting setuptools-rust>=0.11.4
    Downloading setuptools_rust-0.12.1-py3-none-any.whl (22 kB)
  Collecting pycparser
    Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Collecting semantic-version>=2.6.0
    Downloading semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
  Collecting toml>=0.9.0
    Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
  Building wheels for collected packages: cffi
    Building wheel for cffi (setup.py): started
    Building wheel for cffi (setup.py): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-yjzsb3c1
         cwd: /tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/
    Complete output (58 lines):
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libffi', required by 'virtual:world', not found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libffi', required by 'virtual:world', not found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libffi', required by 'virtual:world', not found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libffi', required by 'virtual:world', not found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libffi', required by 'virtual:world', not found
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/verifier.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/lock.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/error.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/api.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/model.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/cparser.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/recompiler.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/__init__.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/commontypes.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/_embedding.h -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.9/cffi
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/c
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.9/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
       15 | #include <ffi.h>
          |          ^~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
    ERROR: Failed building wheel for cffi
    Running setup.py clean for cffi
  Failed to build cffi
  Installing collected packages: toml, setuptools, semantic-version, pycparser, wheel, setuptools-rust, cffi
      Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tfge4z1o/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-yrjqd7km/overlay --compile --install-headers /tmp/pip-build-env-yrjqd7km/overlay/include/python3.9/cffi
           cwd: /tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/
      Complete output (58 lines):
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      creating build/lib.linux-x86_64-3.9/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/verifier.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/lock.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/error.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/api.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/model.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/cparser.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/recompiler.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/__init__.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/commontypes.py -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/_embedding.h -> build/lib.linux-x86_64-3.9/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.9/cffi
      warning: build_py: byte-compiling is disabled, skipping.

      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-x86_64-3.9
      creating build/temp.linux-x86_64-3.9/c
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.9/c/_cffi_backend.o
      c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
         15 | #include <ffi.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ffru69t9/cffi_852c86e0f2b54be7b7451bb5b3d505b7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tfge4z1o/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-yrjqd7km/overlay --compile --install-headers /tmp/pip-build-env-yrjqd7km/overlay/include/python3.9/cffi Check the logs for full command output.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/9b/77/461087a514d2e8ece1c975d8216bc03f7048e6090c5166bc34115afdaa53/cryptography-3.4.7.tar.gz#sha256=3d10de8116d25649631977cb37da6cbdd2d6fa0e0281d014a5b7d337255ca713 (from https://pypi.org/simple/cryptography/) (requires-python:>=3.6). Command errored out with exit status 1: /usr/local/bin/python /tmp/pip-standalone-pip-j5e9jkuc/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-yrjqd7km/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4' Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement cryptography==3.4.7 (from versions: 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.4, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6, 0.6.1, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.9, 0.9.1, 0.9.2, 0.9.3, 1.0, 1.0.1, 1.0.2, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.7, 1.7.1, 1.7.2, 1.8, 1.8.1, 1.8.2, 1.9, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2, 2.2.1, 2.2.2, 2.3, 2.3.1, 2.4, 2.4.1, 2.4.2, 2.5, 2.6, 2.6.1, 2.7, 2.8, 2.9, 2.9.1, 2.9.2, 3.0, 3.1, 3.1.1, 3.2, 3.2.1, 3.3, 3.3.1, 3.3.2, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7)
ERROR: No matching distribution found for cryptography==3.4.7
ERROR: Service 'web' failed to build : The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
==================================

에러나는 패키지 삭제하고 다시 빌드하면 다른 패키지에서 또 에러나고...

책과 같은 버전에 맞춰서 다시 만들어야 할까요?

추가로 아래 패키지에서도 에러가 발생합니다.
idna==3.2
PyJWT==2.1.0

해결 방법 좀 알려주시면 감사하겠습니다.


sungyong
sungyong   3 years, 4 months ago

안녕하세요. cryptography 설치과정에서 문제가 생기고 있네요. 

저희가 책을 쓸 때와 달리, AWS의 우분투를 활용할 경우, cryptgraphy 설치가 잘 안되는 현상이 보고되었습니다. 

이 부분에 대해 저희 doitdjango의 블로그에 cryptography 오류시 대처법 이라는 글로 안내해 두었으니, 참고하시기 바랍니다. 

혹시 글로만 파악이 어려우시다면, 인프런 동영상 강좌를 참고해주세요. 이 문제가 발생하지 않도록 작업하는 과정을 동영상으로 찍어놓았습니다. 유료강좌이지만, 도커 부분부터는 무료로 보실 수 있도록 공개해두었습니다. 


Updated: June 24, 2021, 8:33 p.m.

jinioji
jinioji   3 years, 4 months ago

덕분에 해결했습니다.

추가로 idna==3.2 → idna==2.10으로 변경해야 에러가 발생하지 않습니다.

감사합니다.

Updated: June 24, 2021, 9:30 p.m.

Leave a Comment:
목록보기
Search
  • 자유게시판
  • Q&A