What is the meaning of "Failed building wheel for flask-mysqldb" in pip3 install?

138 Views Asked by At

I have a MacBook Air with macOs Sonoma 14.0 and when I write in the terminal

$ pip3 install flask-mysqldb

I get the error:

enter image description here

How can I fix this?

1

There are 1 best solutions below

0
Brian61354270 On

You're using a very new version Python (3.12, released just this month) that mysqlclient (a dependency of the distribution you're trying to install) does not yet provide pre-built wheels for.

Because of this, pip is trying to build mysqlclient from source. This is fails because you're missing some required system dependencies.

You can consult mysqlclient's documentation for its exact build dependencies. At a minimum, you'll need to install pkg-config based on that error message.

Alternatively, you can switch to a version of Python that msqlclient supports and provides wheels for. Currently, that's Python 3.8 - 3.11 for mysqlclient v2.2.0.