Dan
Dan

Reputation: 73

error during installation of flask-mysqldb (python 3) on a mac (OS High Sierra)

While following an online tutorial to create a Flask web-app, I was trying to install flask-mysqldb with sudo pip3 install flask-mysqldb. This results in an installation error which seems to stem from a dependency problem. The error message is as follows Command "/usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-nbajn5in/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-_eid7ul7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-nbajn5in/mysqlclient/ I have not been able to find any resources indicating a way forward outside of abandoning flask-mysqldb in favour of another module. Thanks

Upvotes: 2

Views: 4802

Answers (2)

NotTooTechy
NotTooTechy

Reputation: 486

I had the same issue it worked fine after installing:

sudo apt-get install libmysqlclient-dev
# make sure all essentials are there
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

Upvotes: 0

Dan
Dan

Reputation: 73

Thanks to those who replied, I employed a workaround by downloading another flask module (flask-mysql) and used that to access my MySQL DB. If you encounter this issue and wish to implement flask-mysql instead of flask-mysqldb follow the instructions here https://flask-mysql.readthedocs.io/en/latest/# . The installation error remains unsolved and I'll log it with the flask-mysqldb people. Regards.

Upvotes: 3

Related Questions