mysqlclient

mysqlclient error while deploying flask project. Please help.
Solution:
you aren't going crazy, this won't work. please move to the pure python mysql client called pymysql instead...
Jump to solution
29 Replies
Percy
Percy7mo ago
Project ID: 6d7cf3b3-efd7-4d44-b920-47b37c7255fb
Venkat321
Venkat3217mo ago
project ID: 6d7cf3b3-efd7-4d44-b920-47b37c7255fb
Adam
Adam7mo ago
please send your requirements.txt file
Venkat321
Venkat3217mo ago
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
Adam
Adam7mo ago
create a nixpacks.toml in your project root with the contents:
[phases.setup]
aptPkgs = […, ‘pkg-config’]
[phases.setup]
aptPkgs = […, ‘pkg-config’]
Venkat321
Venkat3217mo ago
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 ?
Adam
Adam7mo ago
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
Venkat321
Venkat3217mo ago
is this right : updated it to : [phases.setup] aptPkgs = ['...', 'pkg-config']
Adam
Adam7mo ago
yes
Venkat321
Venkat3217mo ago
i got same error again
Adam
Adam7mo ago
please send the file itself, i’ll take a look
Venkat321
Venkat3217mo ago
@Adam which file ?
Adam
Adam7mo ago
the nixpacks.toml you created
Venkat321
Venkat3217mo ago
thats all i added nothing more @Adam Just these two lines: [phases.setup] aptPkgs = ['...', 'pkg-config']
Adam
Adam7mo ago
Wondering if the periods are the issue... @Brody I'm going crazy here, am I missing something? replace your file with this one
Venkat321
Venkat3217mo ago
@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 } }
Adam
Adam7mo ago
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
Brody
Brody7mo ago
you aren't going crazy, this won't work. please move to the pure python mysql client called pymysql instead
Venkat321
Venkat3217mo ago
ok, i will change package to mysql and try it
Brody
Brody7mo ago
pymysql*
Venkat321
Venkat3217mo ago
please give me some time, thaks for reponses @Adam
Adam
Adam7mo ago
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:...
Adam
Adam7mo ago
Pretty sure it will?
Venkat321
Venkat3217mo ago
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
Brody
Brody7mo ago
it's not as simple as that unfortunately
Adam
Adam7mo ago
you effectively added them in the nixpacks.toml. Putting packages under the aptPkgs section tells Nixpacks to apt install them
Brody
Brody7mo ago
for this case, it will run the applicable apt install command, but the package will appear not to have been installed
Adam
Adam7mo ago
?? 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
Want results from more Discord servers?
Add your server
More Posts