pip install flask-mysqldb
C:\Users\prince>pip install flask-mysqldb Collecting flask-mysqldb
Using cached
https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from flask-mysqldb) (1.1.1) Collecting mysqlclient (from
flask-mysqldb) Using cached
https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
Requirement already satisfied: Werkzeug>=0.15 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (0.16.0) Requirement already
satisfied: Jinja2>=2.10.1 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (2.10.1) Requirement already
satisfied: itsdangerous>=0.24 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (1.1.0) Requirement already
satisfied: click>=5.1 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Flask>=0.10->flask-mysqldb) (7.0) Requirement already satisfied:
MarkupSafe>=0.23 in
c:\users\prince\appdata\local\programs\python\python37-32\lib\site-packages
(from Jinja2>=2.10.1->Flask>=0.10->flask-mysqldb) (1.1.1) Installing
collected packages: mysqlclient, flask-mysqldb Running setup.py
install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\prince\appdata\local\programs\python\python37-32\python.exe'
-u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\setup.py'"'"';
file='"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\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
'C:\Users\prince\AppData\Local\Temp\pip-record-8l4u4qqk\install-record.txt'
--single-version-externally-managed --compile
cwd: C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,4,'final',0)
-D__version__=1.4.4 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\prince\appdata\local\programs\python\python37-32\include -Ic:\users\prince\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.23.28105\ATLMFC\include"
"-IC:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt"
/TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj
/Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe'
failed with exit status 2
---------------------------------------- ERROR: Command errored out with exit status 1:
'c:\users\prince\appdata\local\programs\python\python37-32\python.exe'
-u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\mysqlclient\setup.py'"'"';
file='"'"'C:\Users\prince\AppData\Local\Temp\pip-install-sb1cs5ex\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
'C:\Users\prince\AppData\Local\Temp\pip-record-8l4u4qqk\install-record.txt'
--single-version-externally-managed --compile Check the logs for full command output.
It didn't worked for me too, but after clicking the link provided by #Suraj Virkar, I noticed that the command for installing is a little different. So instead of using
pip install flask-mysqldb
Just use
pip install Flask-MySQL
and i'm not really sure why but it worked! it must have someting to do with the versions i guess... oh and take note that you'll have to use
from flaskext.mysql import MySQL
to import it on your project instead of using
from flask_mysqldb import MySQL
Hope this helps...
try to install flask-mysqldb by the following method
Installation
pip install flask-mysqldb
if you get error or system cannot fetch wheel file of flask-mysqldb, then go to this link
where you can download wheel file and then run that wheel file.
If this also not working then first install mysqlclient
pip install mysqlclient
and then install flask-mysqldb.
Related
this the massage i get
pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\thewoods\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TheWoods\\AppData\\Local\\Temp\\pip-install-do75yjl_\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\TheWoods\\AppData\\Local\\Temp\\pip-install-do75yjl_\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\TheWoods\AppData\Local\Temp\pip-wheel-3e8m_6rp'
cwd: C:\Users\TheWoods\AppData\Local\Temp\pip-install-do75yjl_\mysqlclient\
Complete output (30 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb
creating build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\thewoods\appdata\local\programs\python\python38-32\include -Ic:\users\thewoods\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\thewoods\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TheWoods\\AppData\\Local\\Temp\\pip-install-do75yjl_\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\TheWoods\\AppData\\Local\\Temp\\pip-install-do75yjl_\\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 'C:\Users\TheWoods\AppData\Local\Temp\pip-record-hyswpe_s\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\thewoods\appdata\local\programs\python\python38-32\Include\mysqlclient'
cwd: C:\Users\TheWoods\AppData\Local\Temp\pip-install-do75yjl_\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb
creating build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\thewoods\appdata\local\programs\python\python38-32\include -Ic:\users\thewoods\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\thewoods\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\TheWoods\AppData\Local\Temp\pip-install-do75yjl_\mysqlclient\setup.py'"'"'; file='"'"'C:\Users\TheWoods\AppData\Local\Temp\pip-install-do75yjl_\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 'C:\Users\TheWoods\AppData\Local\Temp\pip-record-hyswpe_s\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\thewoods\appdata\local\programs\python\python38-32\Include\mysqlclient' Check the logs for full command output.
i think i solved it ,but im not sure why that worked , i have windows 10 x64 so i downloaded the 64 version file from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
but it didnt work after that i downloaded the 32 version and it worked
and i checked after that i ran "pip insatll mysqlclient"
i got
Requirement already satisfied: mysqlclient
programs\python\python38-32\lib\site-packages (1.4.6)
I believe, I also have one solution for this problem. I am using Python 3.8.3. Following is the information
<<Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32>>
Do the following
Goto - [https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient][1]
Download - mysqlclient-1.4.6-cp38-cp38-win32.whl - as per the Python version I am using.
Ensure that the pip version is 20.0.1. Use python -m pip install -U pip==20.0.1
Run the command pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
This worked for me.
Following were the versions of modules installed on my machine when the command pip install mysqlclient-1.4.6-cp38-cp38-win32.whl did not work on my machine.
Package Version
asgiref==>3.2.7
Django==>3.0.7
pip==>20.1.1
pytz==>2020.1
setuptools==>47.1.1
sqlparse==>0.3.1
wheel==>0.34.2
Hope this will help
I think the error occurred because Visual C++ 14.0 does not exist.
Please refer to the link below.
Pip error: Microsoft Visual C++ 14.0 is required
I trying to install MYSQL on window 10 64 bit , I have python3.7.4 version when I tray pip install mysql I got Error MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory , so I have
Python Version: 3.7.4
Operating System: Windows 10
Pip Version: 20.1
Cannot pip install flask-mysqldb
Here is a summary of the error i'm getting...
C:\Users\Omar Faaruuq>pip install mysql
Collecting mysql
Downloading mysql-0.0.2.tar.gz (1.9 kB)
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Building wheels for collected packages: mysql, mysqlclient
Building wheel for mysql (setup.py) ... done
Created wheel for mysql: filename=mysql-0.0.2-py3-none-any.whl size=1252 sha256=fd9a7bdc9cfebc286a66598c32d555b935dfa38a3e1b687096dfa22bf50100d1
Stored in directory: c:\users\omar faaruuq\appdata\local\pip\cache\wheels\f6\60\6d\b1cf0653d003ddb0be2985a4d5f2c6f977d91f0862df094de8
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\omar faaruuq\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\OMARFA~1\\AppData\\Local\\Temp\\pip-install-m0eys0mm\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\OMARFA~1\\AppData\\Local\\Temp\\pip-install-m0eys0mm\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\OMARFA~1\AppData\Local\Temp\pip-wheel-usgog472'
cwd: C:\Users\OMARFA~1\AppData\Local\Temp\pip-install-m0eys0mm\mysqlclient\
Complete output (30 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\omar faaruuq\appdata\local\programs\python\python37-32\include" "-Ic:\users\omar faaruuq\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Successfully built mysql
Failed to build mysqlclient
Installing collected packages: mysqlclient, mysql
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\omar faaruuq\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\OMARFA~1\\AppData\\Local\\Temp\\pip-install-m0eys0mm\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\OMARFA~1\\AppData\\Local\\Temp\\pip-install-m0eys0mm\\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 'C:\Users\OMARFA~1\AppData\Local\Temp\pip-record-cc7qd2yb\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\omar faaruuq\appdata\local\programs\python\python37-32\Include\mysqlclient'
cwd: C:\Users\OMARFA~1\AppData\Local\Temp\pip-install-m0eys0mm\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\omar faaruuq\appdata\local\programs\python\python37-32\include" "-Ic:\users\omar faaruuq\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\omar faaruuq\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\OMARFA~1\\AppData\\Local\\Temp\\pip-install-m0eys0mm\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\OMARFA~1\\AppData\\Local\\Temp\\pip-install-m0eys0mm\\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 'C:\Users\OMARFA~1\AppData\Local\Temp\pip-record-cc7qd2yb\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\omar faaruuq\appdata\local\programs\python\python37-32\Include\mysqlclient' Check the logs for full command output.
You'll have to install Visual Studio Build Tools and MySQL connector
or
Install mysqlclient through unoficiall wheel by downloading it and installing
pip install mysqlclient‑1.4.6‑cp37‑cp37m‑win_amd64.whl
This question already has answers here:
pip install mysqlclient returns "fatal error C1083: Cannot open file: 'mysql.h': No such file or directory
(18 answers)
Closed 2 years ago.
I am trying to install mysqlclient and getting the following error.
C:\Users\Yash Patel>pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Using legacy setup.py install for mysqlclient, since package 'wheel' is not installed.
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\yash patel\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\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 'C:\Users\YASHPA~1\AppData\Local\Temp\pip-record-diaiyo1_\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\yash patel\appdata\local\programs\python\python37-32\Include\mysqlclient'
cwd: C:\Users\YASHPA~1\AppData\Local\Temp\pip-install-sc96zvsc\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\yash patel\appdata\local\programs\python\python37-32\include" "-Ic:\users\yash patel\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\yash patel\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\YASHPA~1\\AppData\\Local\\Temp\\pip-install-sc96zvsc\\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 'C:\Users\YASHPA~1\AppData\Local\Temp\pip-record-diaiyo1_\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\yash patel\appdata\local\programs\python\python37-32\Include\mysqlclient' Check the logs for full command output.
You need to have mysql client (the actual db client software) installed on your device. When mysql client is installed the source files will be available for python to compile mysqlclient python module.
There is an alternative for this module. You may install pymysql. However this module is not being recommended for production purposes. This module is pure python so not it would not give the required performance.
If you use pymylsq you need to add 2 lines on the manage.py so you may use runserver.
manage.py
import pymysql
pymysql.install_as_MySQLdb()
...
...
I hope you are doing great !
I am trying to do application with django framework that bringing the data from mysql database and do reports on it.
I have a problems while installing mysqlclient in windows by commands I tried a lot but always the same error
can you advice me guys ?
by the way this is the error guys.
C:\Users\lenovo ideapad\Desktop\django-chartit\django-project\my_chartit>pip
install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\lenovo ideapad\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LENOVO~1\\AppData\\Local\\Temp\\pip-install-ntl230oc\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\LENOVO~1\\AppData\\Local\\Temp\\pip-install-ntl230oc\\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 'C:\Users\LENOVO~1\AppData\Local\Temp\pip-record-5fst2b2v\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lenovo ideapad\appdata\local\programs\python\python37-32\Include\mysqlclient'
cwd: C:\Users\LENOVO~1\AppData\Local\Temp\pip-install-ntl230oc\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" "-Ic:\users\lenovo ideapad\appdata\local\programs\python\python37-32\include" "-Ic:\users\lenovo ideapad\appdata\local\programs\python\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'mysql.h'ÿ: No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lenovo ideapad\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LENOVO~1\\AppData\\Local\\Temp\\pip-install-ntl230oc\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\LENOVO~1\\AppData\\Local\\Temp\\pip-install-ntl230oc\\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 'C:\Users\LENOVO~1\AppData\Local\Temp\pip-record-5fst2b2v\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lenovo ideapad\appdata\local\programs\python\python37-32\Include\mysqlclient' Check the logs for full command output.
lot of people have problems to install mysqlclient in windows with pip, and it seems there is no solution for this.
but if you use anaconda you can install mysqlclient properly.
create virtual environment with conda and install mysqlclient with pip install mysqlclient command
My OS is win 10 x64, python is 3.5.2,
I am installing mysqlclient via pip install mysqlclient,
there are some errors,as follow:
D:\demo>pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.7.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command c:\users\dell\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dell\\AppData\\Local\\Temp\\pip-build-95hytmeq\\mysqlclient\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\dell\AppData\Local\Temp\pip-wv5bnfnn-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.5
copying _mysql_exceptions.py -> build\lib.win32-3.5
creating build\lib.win32-3.5\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.5\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.5\MySQLdb
creating build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.5\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.5\MySQLdb\constants
running build_ext
building '_mysql' extension
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\users\dell\appdata\local\programs\python\python35-32\include -Ic:\users\dell\appdata\local\programs\python\python35-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tc_mysql.c /Fobuild\temp.win32-3.5\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(29): fatal error C1083: Cannot open include file: 'my_config.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\dell\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dell\\AppData\\Local\\Temp\\pip-build-95hytmeq\\mysqlclient\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\dell\AppData\Local\Temp\pip-wv5bnfnn-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\dell\AppData\Local\Temp\pip-build-95hytmeq\mysqlclient\
What should I do?
try downloading the .whl file for your windows and python configuration from this link
and after install that .whl file with command
pip install /path/to/your/.whl file/some-package.whl
This happens to me:
(py352) C:\pyvenv>pip install mysqlclient-1.3.7-cp27-none-win_amd64.whl (enter)
Salida:
mysqlclient-1.3.7-cp27-none-win_amd64.whl is not a supported wheel on this platform.