Q&A
책을 따라하다가 막히는 부분이 있나요?
질문을 남겨주세요.
하지만, 책을 끝까지 읽고 나면 이 페이지도 만드실 수 있을거에요.
psycopg2 추가후 docker-compose build시 에러가 발생합니다.
3 years, 4 months ago
jinioji안녕하세요.
PostgreSQL 사용하기 부분 진행 중입니다.
psycopg2 인스톨 후 docker-compose build 하면 다음과 같은 에러가 발생합니다.
===============================================================
#9 10.02 Collecting psycopg2==2.9.1
#9 10.03 Downloading psycopg2-2.9.1.tar.gz (379 kB)
#9 10.92 ERROR: Command errored out with exit status 1:
#9 10.92 command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2i7b0xu7/psycopg2_778a430ed5c64f96946f473875716446/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2i7b0xu7/psycopg2_778a430ed5c64f96946f473875716446/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'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-qe4lgxle
#9 10.92 cwd: /tmp/pip-install-2i7b0xu7/psycopg2_778a430ed5c64f96946f473875716446/
#9 10.92 Complete output (23 lines):
#9 10.92 running egg_info
#9 10.92 creating /tmp/pip-pip-egg-info-qe4lgxle/psycopg2.egg-info
#9 10.92 writing /tmp/pip-pip-egg-info-qe4lgxle/psycopg2.egg-info/PKG-INFO
#9 10.92 writing dependency_links to /tmp/pip-pip-egg-info-qe4lgxle/psycopg2.egg-info/dependency_links.txt
#9 10.92 writing top-level names to /tmp/pip-pip-egg-info-qe4lgxle/psycopg2.egg-info/top_level.txt
#9 10.92 writing manifest file '/tmp/pip-pip-egg-info-qe4lgxle/psycopg2.egg-info/SOURCES.txt'
#9 10.92
#9 10.92 Error: pg_config executable not found.
#9 10.92
#9 10.92 pg_config is required to build psycopg2 from source. Please add the directory
#9 10.92 containing pg_config to the $PATH or specify the full executable path with the
#9 10.92 option:
#9 10.92
#9 10.92 python setup.py build_ext --pg-config /path/to/pg_config build ...
#9 10.92
#9 10.92 or with the pg_config option in 'setup.cfg'.
#9 10.92
#9 10.92 If you prefer to avoid building psycopg2 from source, please install the PyPI
#9 10.92 'psycopg2-binary' package instead.
#9 10.92
#9 10.92 For further information please check the 'doc/src/install.rst' file (also at
#9 10.92 <https://www.psycopg.org/docs/install.html>).
#9 10.92
#9 10.92 ----------------------------------------
#9 10.92 WARNING: Discarding https://files.pythonhosted.org/packages/aa/8a/7c80e7e44fb1b4277e89bd9ca509aefdd4dd1b2c547c6f293afe9f7ffd04/psycopg2-2.9.1.tar.gz#sha256=de5303a6f1d0a7a34b9d40e4d3bef684ccc44a49bbe3eb85e3c0bffb4a131b7c (from https://pypi.org/simple/psycopg2/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#9 10.93 ERROR: Could not find a version that satisfies the requirement psycopg2==2.9.1 (from versions: 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.14, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6, 2.6.1, 2.6.2, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.7.3.1, 2.7.3.2, 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1)
#9 10.93 ERROR: No matching distribution found for psycopg2==2.9.1
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1
ERROR: Service 'web' failed to build : Build failed
===============================================================
아래는 docker-compose.yml 내용입니다.
version: '3'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./:/usr/src/app/
ports:
- 8000:8000
env_file:
- ./.env.dev
depends_on:
- db
db:
image: postgres:12.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=do_it_django_db_user
- POSTGRES_PASSWORD=do_it_django_db_password
- POSTGRES_DB=do_it_django_dev
volumes:
postgres_data:
해결 방법 좀 알려주실 수 있으신지요...
감사합니다.
목록보기
jinioji 3 years, 4 months ago
해결했습니다.
psycopg2 대신에 psycopg2-binary로 인스톨하고 다시 빌드 하니 문제없이 빌드 완료됐습니다.
감사합니다.
Updated: June 25, 2021, 1:54 p.m.
Leave a Comment: