에러 출력 내용
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-w06o8t8k/mysqlclient_e734938cf6d148aeab1e70c686ed01b1/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-w06o8t8k/mysqlclient_e734938cf6d148aeab1e70c686ed01b1/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-w06o8t8k/mysqlclient_e734938cf6d148aeab1e70c686ed01b1/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
에러 해결한 방법
$ sudo apt-get install python-dev
$ sudo apt-get install python-dev libmysqlclient-dev
$ pip install -r requirements.txt
로 pip 패키지를 설치해두던 중, 에러가 발생했다.
mysqlclient==2.0.1을 설치하려고 하는데,
Collecting mysqlclient==2.0.1
Using cached mysqlclient-2.0.1.tar.gz (87 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-sxowu1l0/mysqlclient_81ca1a6818ca45699ddfa01cadccd2d8/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-sxowu1l0/mysqlclient_81ca1a6818ca45699ddfa01cadccd2d8/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-sxowu1l0/mysqlclient_81ca1a6818ca45699ddfa01cadccd2d8/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
이런 에러가 난 것이다.
처음에는 error:command errored out with exit status 1 : python setup.py egg_info 에러로 나왔다.
Collecting asgiref==3.4.1
Using cached asgiref-3.4.1-py3-none-any.whl (25 kB)
Collecting Django==3.2.6
Using cached Django-3.2.6-py3-none-any.whl (7.9 MB)
Collecting mysqlclient==2.0.1
Using cached mysqlclient-2.0.1.tar.gz (87 kB)
ERROR: Command errored out with exit status 1:
command: '/mnt/c/Users/enkee/OneDrive/바탕 화면/3-2/와플/이전세미
나자료/seminar0-assignment/.venv/bin/python3' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-enlp15bx/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-enlp15bx/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,
__file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-enlp15bx/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-enlp15bx/mysqlclient/
Complete output (12 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-enlp15bx/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-enlp15bx/mysqlclient/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-enlp15bx/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
처음에는 pip를 업데이트해주고, setuptools를 업데이트해주었으나 문제가 해결되지 않았다.
그러다 어떤 블로그에서 mysql에 맞는 라이브러리를 미리 설치해야한다는 걸 알고 설치해서 해결했다.
[참고]
[err] python mysql_config not found - yenos (yenoss.github.io)
requirements.txt 파일을 사용하여 Python 패키지 관리하는 방법 (Feat. Django) (tistory.com)
[python] requirements.txt로 패키지 관리하기 | 코딩장이 (itholic.github.io)