Q&A

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

docker-compose build 질문입니다.

1 year, 11 months ago

KIM KIM

안녕하세요!!

DO it django 책을 따라하고 있는 독자입니다!

사실 질문 드렸다가 지웠다가 다시 쓰게 되었습니다..

다름이 아니라, 

docker-compose build 에서 다음 에러가 납니다...


(venv) C:\github\Do_it_django>docker-compose build

[+] Building 96.2s (8/9)

 => [internal] load build definition from Dockerfile                                                               0.0s

 => => transferring dockerfile: 32B                                                                                0.0s

 => [internal] load .dockerignore                                                                                  0.0s

 => => transferring context: 2B                                                                                    0.0s

 => [internal] load metadata for docker.io/library/python:3.8-slim-buster                                          3.6s

 => [internal] load build context                                                                                  4.1s

 => => transferring context: 1.60MB                                                                                4.1s

[+] Building 201.7s (9/9) FINISHED

 => [internal] load build definition from Dockerfile                                                               0.0s

 => => transferring dockerfile: 32B                                                                                0.0s

 => [internal] load .dockerignore                                                                                  0.0s

 => => transferring context: 2B                                                                                    0.0s

 => [internal] load metadata for docker.io/library/python:3.8-slim-buster                                          3.6s

 => [internal] load build context                                                                                  4.1s

 => => transferring context: 1.60MB                                                                                4.1s

 => [1/5] FROM docker.io/library/python:3.8-slim-buster@sha256:4cda66a01b5571bd4f3d634b301f72e580a94b2c1ce87ead05  0.0s

 => CACHED [2/5] WORKDIR /usr/src/app                                                                              0.0s

 => [3/5] COPY . /usr/src/app/                                                                                     2.2s

 => [4/5] RUN pip install --upgrade pip                                                                           17.4s

 => ERROR [5/5] RUN pip install -r requirements.txt                                                              169.8s

------

 > [5/5] RUN pip install -r requirements.txt:

#0 1.665 Collecting asgiref==3.5.2

#0 1.798   Downloading asgiref-3.5.2-py3-none-any.whl (22 kB)

#0 2.188 Collecting asttokens==2.2.1

#0 2.262   Downloading asttokens-2.2.1-py2.py3-none-any.whl (26 kB)

#0 2.426 Collecting backcall==0.2.0

#0 2.588   Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)

#0 2.671 Collecting backports.zoneinfo==0.2.1

#0 2.836   Downloading backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl (74 kB)

#0 3.075      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.0/74.0 kB 276.0 kB/s eta 0:00:00

#0 3.133 Collecting beautifulsoup4==4.11.1

#0 3.156   Downloading beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)

#0 3.863      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.2/128.2 kB 254.2 kB/s eta 0:00:00

#0 3.949 Collecting certifi==2022.12.7

#0 3.966   Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)

#0 4.440      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 kB 349.6 kB/s eta 0:00:00

#0 5.175 Collecting cffi==1.15.1

#0 5.191   Downloading cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (442 kB)

#0 7.900      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 442.7/442.7 kB 167.9 kB/s eta 0:00:00

#0 8.374 Collecting charset-normalizer==2.1.1

#0 8.394   Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)

#0 8.703 Collecting colorama==0.4.6

#0 8.720   Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)

#0 10.28 Collecting cryptography==38.0.4

#0 10.33   Downloading cryptography-38.0.4-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)

#0 33.06      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 183.1 kB/s eta 0:00:00

#0 33.13 Collecting decorator==5.1.1

#0 33.15   Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB)

#0 33.24 Collecting defusedxml==0.7.1

#0 33.33   Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)

#0 33.54 Collecting dj-database-url==1.2.0

#0 33.63   Downloading dj_database_url-1.2.0-py3-none-any.whl (7.1 kB)

#0 34.18 Collecting Django==4.1.4

#0 34.20   Downloading Django-4.1.4-py3-none-any.whl (8.1 MB)

#0 76.41      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.1/8.1 MB 187.7 kB/s eta 0:00:00

#0 76.53 Collecting django-allauth==0.51.0

#0 76.56   Downloading django-allauth-0.51.0.tar.gz (709 kB)

#0 80.82      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 709.6/709.6 kB 171.8 kB/s eta 0:00:00

#0 81.10   Preparing metadata (setup.py): started

#0 81.90   Preparing metadata (setup.py): finished with status 'done'

#0 82.03 Collecting django-cors-headers==3.13.0

#0 82.10   Downloading django_cors_headers-3.13.0-py3-none-any.whl (13 kB)

#0 82.19 Collecting django-crispy-forms==1.14.0

#0 82.26   Downloading django_crispy_forms-1.14.0-py3-none-any.whl (133 kB)

#0 82.71      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 kB 278.1 kB/s eta 0:00:00

#0 82.95 Collecting django-extensions==3.2.1

#0 82.96   Downloading django_extensions-3.2.1-py3-none-any.whl (229 kB)

#0 83.93      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.4/229.4 kB 240.5 kB/s eta 0:00:00

#0 83.98 Collecting django-heroku==0.3.1

#0 84.00   Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)

#0 84.11 Collecting executing==1.2.0

#0 84.13   Downloading executing-1.2.0-py2.py3-none-any.whl (24 kB)

#0 84.34 Collecting gunicorn==20.1.0

#0 84.36   Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)

#0 84.82      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 184.7 kB/s eta 0:00:00

#0 85.29 Collecting idna==3.4

#0 85.37   Downloading idna-3.4-py3-none-any.whl (61 kB)

#0 86.15      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 78.7 kB/s eta 0:00:00

#0 86.45 Collecting importlib-metadata==5.2.0

#0 86.65   Downloading importlib_metadata-5.2.0-py3-none-any.whl (21 kB)

#0 87.11 Collecting ipython==8.7.0

#0 87.20   Downloading ipython-8.7.0-py3-none-any.whl (761 kB)

#0 91.06      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 761.7/761.7 kB 195.3 kB/s eta 0:00:00

#0 91.25 Collecting jedi==0.18.2

#0 91.27   Downloading jedi-0.18.2-py2.py3-none-any.whl (1.6 MB)

#0 99.54      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 192.2 kB/s eta 0:00:00

#0 99.70 Collecting Markdown==3.4.1

#0 99.71   Downloading Markdown-3.4.1-py3-none-any.whl (93 kB)

#0 100.4      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.3/93.3 kB 255.2 kB/s eta 0:00:00

#0 100.4 Collecting matplotlib-inline==0.1.6

#0 100.5   Downloading matplotlib_inline-0.1.6-py3-none-any.whl (9.4 kB)

#0 100.6 Collecting oauthlib==3.2.2

#0 100.6   Downloading oauthlib-3.2.2-py3-none-any.whl (151 kB)

#0 101.4      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.7/151.7 kB 180.8 kB/s eta 0:00:00

#0 101.5 Collecting parso==0.8.3

#0 101.5   Downloading parso-0.8.3-py2.py3-none-any.whl (100 kB)

#0 101.8      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.8/100.8 kB 404.2 kB/s eta 0:00:00

#0 101.8 Collecting pickleshare==0.7.5

#0 101.8   Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)

#0 103.5 Collecting Pillow==9.3.0

#0 103.5   Downloading Pillow-9.3.0-cp38-cp38-manylinux_2_28_x86_64.whl (3.3 MB)

#0 125.0      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 152.5 kB/s eta 0:00:00

#0 125.2 Collecting prompt-toolkit==3.0.36

#0 125.2   Downloading prompt_toolkit-3.0.36-py3-none-any.whl (386 kB)

#0 127.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 386.4/386.4 kB 173.4 kB/s eta 0:00:00

#0 128.3 Collecting psycopg2-binary==2.9.5

#0 128.3   Downloading psycopg2_binary-2.9.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)

#0 145.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 172.7 kB/s eta 0:00:00

#0 145.7 Collecting pure-eval==0.2.2

#0 145.7   Downloading pure_eval-0.2.2-py3-none-any.whl (11 kB)

#0 146.6 Collecting pycparser==2.21

#0 146.7   Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)

#0 147.6      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 129.1 kB/s eta 0:00:00

#0 147.8 Collecting Pygments==2.13.0

#0 147.9   Downloading Pygments-2.13.0-py3-none-any.whl (1.1 MB)

#0 154.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 161.4 kB/s eta 0:00:00

#0 154.8 Collecting PyJWT==2.6.0

#0 154.9   Downloading PyJWT-2.6.0-py3-none-any.whl (20 kB)

#0 154.9 Collecting python3-openid==3.2.0

#0 155.0   Downloading python3_openid-3.2.0-py3-none-any.whl (133 kB)

#0 155.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.7/133.7 kB 227.9 kB/s eta 0:00:00

#0 155.9 Collecting requests==2.28.1

#0 155.9   Downloading requests-2.28.1-py3-none-any.whl (62 kB)

#0 156.4      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 327.2 kB/s eta 0:00:00

#0 156.5 Collecting requests-oauthlib==1.3.1

#0 156.8   Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)

#0 156.9 Collecting six==1.16.0

#0 156.9   Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)

#0 157.1 Collecting soupsieve==2.3.2.post1

#0 157.1   Downloading soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)

#0 157.4 Collecting sqlparse==0.4.3

#0 157.4   Downloading sqlparse-0.4.3-py3-none-any.whl (42 kB)

#0 157.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.8/42.8 kB 180.4 kB/s eta 0:00:00

#0 157.8 Collecting stack-data==0.6.2

#0 158.4   Downloading stack_data-0.6.2-py3-none-any.whl (24 kB)

#0 158.8 Collecting traitlets==5.8.0

#0 158.9   Downloading traitlets-5.8.0-py3-none-any.whl (116 kB)

#0 159.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.8/116.8 kB 156.3 kB/s eta 0:00:00

#0 159.7 Collecting typing_extensions==4.4.0

#0 159.7   Downloading typing_extensions-4.4.0-py3-none-any.whl (26 kB)

#0 160.1 Collecting tzdata==2022.7

#0 160.1   Downloading tzdata-2022.7-py2.py3-none-any.whl (340 kB)

#0 162.8      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 340.1/340.1 kB 129.3 kB/s eta 0:00:00

#0 163.4 Collecting urllib3==1.26.13

#0 163.4   Downloading urllib3-1.26.13-py2.py3-none-any.whl (140 kB)

#0 164.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.6/140.6 kB 135.9 kB/s eta 0:00:00

#0 164.7 Collecting wcwidth==0.2.5

#0 164.8   Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)

#0 165.0 Collecting whitenoise==6.2.0

#0 165.0   Downloading whitenoise-6.2.0-py3-none-any.whl (19 kB)

#0 165.2 Collecting zipp==3.11.0

#0 165.2   Downloading zipp-3.11.0-py3-none-any.whl (6.6 kB)

#0 166.1 Collecting psycopg2

#0 166.2   Downloading psycopg2-2.9.5.tar.gz (384 kB)

#0 168.7      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.3/384.3 kB 150.0 kB/s eta 0:00:00

#0 168.8   Preparing metadata (setup.py): started

#0 169.5   Preparing metadata (setup.py): finished with status 'error'

#0 169.5   error: subprocess-exited-with-error

#0 169.5

#0 169.5   × python setup.py egg_info did not run successfully.

#0 169.5   │ exit code: 1

#0 169.5   ╰─> [23 lines of output]

#0 169.5       running egg_info

#0 169.5       creating /tmp/pip-pip-egg-info-7zdxv3mc/psycopg2.egg-info

#0 169.5       writing /tmp/pip-pip-egg-info-7zdxv3mc/psycopg2.egg-info/PKG-INFO

#0 169.5       writing dependency_links to /tmp/pip-pip-egg-info-7zdxv3mc/psycopg2.egg-info/dependency_links.txt

#0 169.5       writing top-level names to /tmp/pip-pip-egg-info-7zdxv3mc/psycopg2.egg-info/top_level.txt

#0 169.5       writing manifest file '/tmp/pip-pip-egg-info-7zdxv3mc/psycopg2.egg-info/SOURCES.txt'

#0 169.5

#0 169.5       Error: pg_config executable not found.

#0 169.5

#0 169.5       pg_config is required to build psycopg2 from source.  Please add the directory

#0 169.5       containing pg_config to the $PATH or specify the full executable path with the

#0 169.5       option:

#0 169.5

#0 169.5           python setup.py build_ext --pg-config /path/to/pg_config build ...

#0 169.5

#0 169.5       or with the pg_config option in 'setup.cfg'.

#0 169.5

#0 169.5       If you prefer to avoid building psycopg2 from source, please install the PyPI

#0 169.5       'psycopg2-binary' package instead.

#0 169.5

#0 169.5       For further information please check the 'doc/src/install.rst' file (also at

#0 169.5       <https://www.psycopg.org/docs/install.html>).

#0 169.5

#0 169.5       [end of output]

#0 169.5

#0 169.5   note: This error originates from a subprocess, and is likely not a problem with pip.

#0 169.5 error: metadata-generation-failed

#0 169.5

#0 169.5 × Encountered error while generating package metadata.

#0 169.5 ╰─> See above for output.

#0 169.5

#0 169.5 note: This is an issue with the package mentioned above, not pip.

#0 169.5 hint: See above for details.

------

failed to solve: executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1



저는 이를 해결하기 위해

pip install psycopg2-binary

pip uninstall psycopg2

pip freeze > requirements.txt 도 해보고


둘 다 install해서도 해보고,

하나씩 해보고...

이것저것 해보다가 안되어서 질문 드렸었는데, 다음 날 아침 학교 수업 듣다가 슥 해봤는데 갑자기 되었습니다....!??

그래서 질문을 지우고, 어떤 조건에서 되는 건지 좀 알아보기 위해

다시 모두 uninstall을 해보았는데....


그 뒤로 다시 쭉 저 에러가 뜨고 있습니다....! 다시 금방 될 줄 알았는데 너무 성급하게 했나봐요..

(제 기억으로는 결국 binary로 된 것 같습니다...)

도무지 어떻게 해야 할지 감이 안 잡혀서 도움을 요청 드립니다!!

시간을 너무 할애해서 힘드네요..ㅠ

감사합니다..ㅜㅠ


sungyong
sungyong   1 year, 10 months ago

해결이 되었는지 모르겠네요. 

제가 재현을 해보기가 어려워서 뭐라 말씀드리기가 어렵지만, requirements.txt가 생성되었을 때, psycopg2-binary를 requirements.txt의 윗쪽으로 옮기면 되지 않을까 짐작하고 있습니다. 

다른 라이브러리를 설치하려고 할 때, psycopg가 없어서 발생하는 문제이니까요. 

Updated: Jan. 15, 2023, 1:41 p.m.

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