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
Asked
Active
Viewed 3,984 times
2
-
Try pip without using sudo – OneCricketeer Jun 18 '18 at 01:02
-
1Possible duplicate of [Install mysqlclient for Django Python on Mac OS X Sierra](https://stackoverflow.com/questions/43612243/install-mysqlclient-for-django-python-on-mac-os-x-sierra) – anthony sottile Jun 18 '18 at 01:05
-
irrespective of the user administration privileges (sudo et al) the problem persists. – Dan Jun 18 '18 at 03:37
2 Answers
2
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.

Dan
- 63
- 1
- 5
0
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

NotTooTechy
- 448
- 5
- 9