I am getting this error when building my docker-compose.yml. I have a django project and when I try to install its dependencies I get the following error:
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_okt_256/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_okt_256/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-pip-egg-info-9yseytwi
cwd: /tmp/pip-install-_okt_256/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-_okt_256/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-_okt_256/mysqlclient/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-_okt_256/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.
Below is my requirements.txt
asgiref==3.2.10
astroid==2.4.2
certifi==2020.6.20
chardet==3.0.4
colorama==0.4.3
defusedxml==0.6.0
Django==3.0.8
django-common-helpers==0.9.2
django-cron==0.5.1
django-templated-mail==1.1.1
djangorestframework==3.11.0
idna==2.10
install==1.3.3
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1
mysqlclient==2.0.1
oauthlib==3.1.0
pylint==2.5.3
pylint-plugin-utils==0.6
python3-openid==3.2.0
pytz==2020.1
requests==2.24.0
requests-oauthlib==1.3.0
six==1.15.0
sqlparse==0.3.1
toml==0.10.1
urllib3==1.25.9
wrapt==1.12.1
Error is popped up while downloading mysqlclient.
Someone help
docker-compose.yml looks like this
version: '3.7'
services:
db:
image: mysql:5.6
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: 'djangodatabase'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: '12345'
MYSQL_ROOT_PASSWORD: '12345'
web:
build: .
command: python manage.py runserver 127.0.0.1:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
Here is my Docker File:
FROM python:3.8-slim
ENV PYTHONBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/