Pip Install MySQLclient Returns "Fatal Error C1083: Cannot Open File: 'Mysql.H': No Such File or Directory

pip install mysqlclient returns fatal error C1083: Cannot open file: 'mysql.h': No such file or directory

You can download unofficial windows binaries for your python version using https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. Then install it using pip. This way you'll be able to avoid the hassle of dealing with visual studio build tools.

Just download the mysqlclient.whl file most applicable to you. I think in your case it'll be

mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl

and run

pip install "path to the downloaded .whl file"

Cannot open include file: 'mysql.h': No such file or directory

The problem is you're using a 32-bit version of Python 3.6, for which there aren't wheels (binary versions) for that version of mysqlclient.

You can see here in the package file list that there is a Windows x32 wheel for 1.3.12 – try that.

pip install mysqlclient==1.3.12

If that fails to install the correct wheel, download mysqlclient-1.3.12-cp36-cp36m-win32.whl from the above listing, then install it with (e.g.) pip install ./mysqlclient-1.3.12-cp36-cp36m-win32.whl

Better still, if you can, switch to the x64 version of Python.

pip install mysqlclient on win64 not working giving error 'Cannot open file: 'mysql.h'

I just got an answer by looking at other options mentioned here.
Actually mistake was that,

  • I have installed Python 3.7.4 with 32 bits on 64bits machine.
  • Code was looking for below path but it was going to the wrong path in program files instead of program files(x86)

C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib

I have installed a new Python with 3.7 with 64 bits and also while installing MySQL connector I have changed the path of installation to the above-mentioned path and now it's working fine.

Thank you, everyone, for your time and help

Cannot install mysqlcient: Cannot open include file: 'mysql.h'

You are missing the mysql headers which you should install through mysql client connector installer.

Easier way would be just to install it through wheel, it should automatically use the official wheel if your python is x64 version but you can download and install unofficial compiled wheel ( you should chose download for your version of python (3.8 x86?) and install it using)

pip install some-package.whl


Related Topics



Leave a reply



Submit