Cannot install flask-mysqldb

Question:

I’ve been trying to install flask-mysqldb using pip install flask-mysqldb, but every time I try it gives me an error that says :

error: command ‘C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428binHostX86x86cl.exe’ failed with exit status 2

I’ve looked around a lot and no answer works for me. I searched the file in https://www.lfd.uci.edu/~gohlke/pythonlibs/ but its not there.

I am on Windows 7 x64.

Asked By: Joaquín Laks

||

Answers:

Of course you can not find whl for flask-mysqldb, but you can find mysqlclient.

Download suitable version for you platform from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

Then, e.g. pip install mysqlclient-1.3.13-cp27-cp27m-win32.whl, depends what you download.

Finally, pip install flask-mysqldb again, this will work for you.

Answered By: atline

the same issue/problem I’ve also received,
That is flask_mysqldb ‘no module’
first of all flask_mysqldb isn’t installed through pip,
You have to install a suitable version for mysqlclient
for me it worked
I’m using window 10 having python3.8 installed……. to rectfiy the error use the follwing procedure:
click on the link
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and select mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl (python3.8 a suitable version for me) download it
then search for the directory where downloaded ….. and then through command prompt type

pip install mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl 

and then

pip install flask_mysqldb 

and done

Answered By: Ziar Khan

I had the same problem

I was using python 3.8 and it’s not supported by this package.
https://flask-mysqldb.readthedocs.io/en/latest/ : Flask-MySQLdb is compatible with and tested on Python 2.7, 3.5, 3.6 and 3.7

I recreated a virtual environment with python 3.7 and it all worked.

installing above must be made

Answered By: Cyril Moysset

For Windows

install pip install wheel

after go to on your browser ‘ https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

find the appropriate package for the python version and download.

and copy that file to C:Users<your-computer-name> .

go to cmd again and write here pip install flask-mysqldb

Answered By: prenszuko
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.