mysqlclient
mysqlclient error while deploying flask project. Please help.
Solution:Jump to solution
you aren't going crazy, this won't work.
please move to the pure python mysql client called pymysql instead...
29 Replies
Project ID:
6d7cf3b3-efd7-4d44-b920-47b37c7255fb
project ID: 6d7cf3b3-efd7-4d44-b920-47b37c7255fb
please send your requirements.txt file
Jinja2==3.1.2
Flask-Cors==4.0.0
gunicorn==21.2.0
MarkupSafe==2.1.3
SQLAlchemy==2.0.23
blinker==1.7.0
click==8.1.7
colorama==0.4.6
flask==3.0.0
flask-marshmallow==0.15.0
flask-sqlalchemy==3.1.1
greenlet==3.0.2
importlib-metadata==7.0.0
itsdangerous==2.1.2
marshmallow==3.20.1
marshmallow-sqlalchemy==0.29.0
mysql-connector-python==8.2.0
packaging==23.2
pip==23.3.2
setuptools==69.0.2
typing-extensions==4.9.0
werkzeug==3.0.1
wheel==0.42.0
zipp==3.17.0
Flask-JWT-Extended==4.6.0
Flask-Mail==0.9.1
PyJWT==2.8.0
bcrypt==4.1.2
importlib-metadata==7.0.0
protobuf==4.21.12
six==1.16.0
typing-extensions==4.9.0
mysqlclient==2.2.1
PyMySQL==1.1.0
create a nixpacks.toml in your project root with the contents:
ok
this is what i get after adding the file:
context: f6d0f4f8eac7081a093f25c11e632344
Nixpacks build failed
Error: Failed to parse Nixpacks config file
nixpacks.toml
Caused by:
unexpected character found: \u{2026}
at line 2 column 12
Can you point what should be in ... in place ?Ah my mistake the ... should be wrapped in quotes as well
the ... tells nixpacks to install everything it auto detects, then it will install pkg-config
is this right :
updated it to :
[phases.setup]
aptPkgs = ['...', 'pkg-config']
yes
i got same error again
please send the file itself, i’ll take a look
@Adam which file ?
the nixpacks.toml you created
thats all i added nothing more
@Adam Just these two lines:
[phases.setup]
aptPkgs = ['...', 'pkg-config']
Wondering if the periods are the issue...
@Brody I'm going crazy here, am I missing something?
replace your file with this one
@Adam i dont see any difference.
@Adam fyi:
i also have railway.json with below config:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "gunicorn run:app",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
The character for the ... was replaced. In the file you sent it was a single character, in mine it is 3
the error you are getting is referencing that character specifically
That railway.json is fine
Solution
you aren't going crazy, this won't work.
please move to the pure python mysql client called pymysql instead
ok, i will change package to mysql and try it
pymysql*
please give me some time, thaks for reponses @Adam
Stack Overflow
Docker Alpine build fails on mysqlclient installation with error: E...
I'm encountering a problem when building a Docker image using a Python-based Dockerfile. I'm trying to use the mysqlclient library (version 2.2.0) and Django (version 4.2.2). Here is my Dockerfile:...
Pretty sure it will?
exactly i did read that post, but not sure whee i should add those commands
can you tell me where i should be adding them
i tried to add in build command , but dint work
it's not as simple as that unfortunately
you effectively added them in the nixpacks.toml. Putting packages under the aptPkgs section tells Nixpacks to apt install them
Configuration File Reference | Nixpacks
App source + Nix packages + Docker = Image
for this case, it will run the applicable apt install command, but the package will appear not to have been installed
??
Brody just showed me a convo with the team, there's a bug in Nixpacks preventing this from working. I would follow Brody's advice here