Error with mysqlclient package in flask project deployment
venkatn7
HOBBYOP

2 years ago

Hi,
I am trying to deploy flask project with "mysqlclient" package to connect db. I am getting below error:

ERROR: failed to solve: process "/bin/bash -ol pipefail -c python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 1

Can you please help.

With regards,

Solved

8 Replies

venkatn7
HOBBYOP

2 years ago

Error i have:
Exception: Can not find valid pkg-config name.

10 12.00 Specify MYSQLCLIENTCFLAGS and MYSQLCLIENTLDFLAGS env vars manually


luca-melop
TRIAL

2 years ago

have you created a correct requirements.txt file?
Try using pip freeze > requirements


venkatn7
HOBBYOP

2 years ago

i have requirement file


venkatn7
HOBBYOP

2 years ago

i think issue with mysqlclient


luca-melop
TRIAL

2 years ago

Is it the correct version in your requirements file? try using pip freeze > requirements. mysqlclient isn't broken


brody
EMPLOYEE

2 years ago

luca, please do not recommend users do pip freeze > requirements.txt (without knowing if they are using a venv locally) as that will freeze all Python packages the user has installed on their system into that txt file.

the solution to this is to move to the pure Python MySQL client called PyMySQL.


Status changed to Solved Railway almost 2 years ago


abrahamx9-r
HOBBY

2 years ago

I have the same problem, but i dont undestand how to solve that, in my requirements file i have
aiofiles==23.2.1
annotated-types==0.6.0
anyio==3.7.1
cffi==1.16.0
click==8.1.7
cryptography==41.0.7
dnspython==2.4.2
exceptiongroup==1.2.1
fastapi==0.104.1
greenlet==3.0.2
h11==0.14.0
idna==3.6
mysqlclient==2.2.4
pycparser==2.21
pydantic==2.5.2
pydanticcore==2.14.5 PyJWT==2.8.0 pymongo==4.6.1 PyMySQL==1.1.0 python-multipart==0.0.6 sniffio==1.3.0 SQLAlchemy==2.0.23 starlette==0.27.0 typingextensions==4.8.0
uvicorn==0.24.0.post1
and is the same problem


brody
EMPLOYEE

2 years ago

Please open your own help thread.


Loading...